Letterboxd Auto-Follow and Auto-Review opener Button

Adds a button to auto-follow all users on a Letterboxd fans page and opens their reviews in new tabs with random delays to mimic human behavior.

  1. // ==UserScript==
  2. // @name Letterboxd Auto-Follow and Auto-Review opener Button
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1.2
  5. // @description Adds a button to auto-follow all users on a Letterboxd fans page and opens their reviews in new tabs with random delays to mimic human behavior.
  6. // @author Your Name
  7. // @match https://letterboxd.com/film/*/fans/page/*
  8. // @match https://letterboxd.com/film/*/fans/
  9. // @match https://letterboxd.com/film/*/members/rated/*/by/rating/*
  10. // @match https://letterboxd.com/*/followers/*/*/
  11. // @match https://letterboxd.com/*/followers/
  12. // @match https://letterboxd.com/*/following/*/*/
  13. // @match https://letterboxd.com/*/following/
  14. // @grant none
  15. // @license MIT
  16. // ==/UserScript==
  17.  
  18. (function() {
  19. 'use strict';
  20.  
  21. // Function to add the auto-follow button
  22. function addAutoFollowButton() {
  23. const button = document.createElement('button');
  24. button.textContent = 'Auto-Follow All & Open Reviews';
  25. button.style.position = 'fixed';
  26. button.style.top = '10px';
  27. button.style.right = '10px';
  28. button.style.zIndex = '1000';
  29. button.style.padding = '10px 20px';
  30. button.style.backgroundColor = '#ffcc00';
  31. button.style.color = '#000';
  32. button.style.border = 'none';
  33. button.style.borderRadius = '5px';
  34. button.style.cursor = 'pointer';
  35.  
  36. button.addEventListener('click', startAutoFollowAndOpenReviews);
  37.  
  38. document.body.appendChild(button);
  39. }
  40.  
  41. // Function to generate a random delay between 0.5 and 2 seconds
  42. function getRandomDelay() {
  43. return Math.random() * (2000 - 500) + 500;
  44. }
  45.  
  46. // Function to auto-follow all users and open their reviews in new tabs with random delays
  47. async function startAutoFollowAndOpenReviews() {
  48. const followButtons = document.querySelectorAll('.js-button-follow');
  49. const reviewLinks = document.querySelectorAll('td a.has-icon.icon-16.icon-review.tooltip');
  50.  
  51. // Log the number of follow buttons and review links
  52. console.log(`Found ${followButtons.length} follow buttons`);
  53. console.log(`Found ${reviewLinks.length} review links`);
  54.  
  55. // Follow all users with random delays
  56. for (let i = 0; i < followButtons.length; i++) {
  57. const button = followButtons[i];
  58. if (button.style.display !== 'none') {
  59. button.click();
  60. await new Promise(resolve => setTimeout(resolve, getRandomDelay()));
  61. }
  62. }
  63.  
  64. // Open reviews in new tabs with random delays
  65. for (let i = 0; i < reviewLinks.length; i++) {
  66. const link = reviewLinks[i];
  67. console.log(`Opening review link: ${link.href}`);
  68. const newWindow = window.open(link.href, '_blank');
  69. if (!newWindow) {
  70. console.error('Failed to open new window for review link:', link.href);
  71. }
  72. await new Promise(resolve => setTimeout(resolve, getRandomDelay()));
  73. }
  74. }
  75.  
  76. // Add the button when the page loads
  77. window.addEventListener('load', addAutoFollowButton);
  78. })();