Instagram Auto Followers/Following Scraper (OSINT)

Auto scraping of all instagram Followers/Following to a .csv with popup controls.

  1. // ==UserScript==
  2. // @name Instagram Auto Followers/Following Scraper (OSINT)
  3. // @version 2.3
  4. // @description Auto scraping of all instagram Followers/Following to a .csv with popup controls.
  5. // @author SH3LL
  6. // @match https://www.instagram.com/*
  7. // @grant GM_notification
  8. // @grant GM_xmlhttpRequest
  9. // @namespace https://gf.qytechs.cn/users/762057
  10. // ==/UserScript==
  11.  
  12. function createPopupButton(text, color,id, clickHandler) {
  13. const button = document.createElement("button");
  14. button.textContent = text;
  15. button.style.backgroundColor = color;
  16. button.style.border = "1px solid";
  17. button.style.paddingX = "2px";
  18. button.id = id;
  19. button.style.borderRadius = "5px";
  20. button.style.cursor = "pointer";
  21. button.addEventListener("click", clickHandler);
  22. return button;
  23. }
  24. function injectScript() {
  25. // RUN floriandiud SCRIPT
  26. GM_xmlhttpRequest({
  27. method: "GET",
  28. url: "https://raw.githubusercontent.com/floriandiud/instagram-users-scraper/refs/heads/main/dist/main.min.js",
  29. onload: function(response) {
  30. const blob = new Blob([response.responseText], { type: 'text/javascript' });
  31. const blobUrl = URL.createObjectURL(blob);
  32.  
  33. import(blobUrl)
  34. .then(module => {
  35. console.log("Module loaded.", module);
  36. })
  37. .catch(error => {
  38. console.error("Error loading the module.", error);
  39. })
  40. .finally(() => {
  41. URL.revokeObjectURL(blobUrl);
  42. });
  43. }
  44. });
  45. let my_inject_button = document.getElementById("my-inject-button");
  46. my_inject_button.disabled = true;
  47. my_inject_button.style.backgroundColor = "grey";
  48. my_inject_button.textContent = "Injected💉"
  49.  
  50. }
  51.  
  52. (function() {
  53. 'use strict';
  54.  
  55. // RUN ONLY IN USER PROFILES PAGES
  56. let url = window.location.href;
  57. let regex = /^https:\/\/www\.instagram\.com\/([a-zA-Z0-9_\.]+)\/$/;
  58. let match = url.match(regex);
  59. if (!match) {
  60. return;
  61. }
  62.  
  63.  
  64. let scrolling = false;
  65. function createPopupButtons() {
  66. const popupContainer = document.createElement("div");
  67. popupContainer.style.position = "absolute";
  68. popupContainer.style.top = "10px";
  69. popupContainer.style.right = "10%";
  70. popupContainer.style.zIndex = "1000";
  71. popupContainer.style.display = "flex";
  72. popupContainer.style.gap = "10px";
  73.  
  74. const injectButton = createPopupButton("Scrape💉", "purple", "my-inject-button", injectScript);
  75. const startScrollButton = createPopupButton("Scroll🔄", "green", "my-autoscrolling-button", startScrolling);
  76.  
  77. popupContainer.appendChild(injectButton);
  78. popupContainer.appendChild(startScrollButton);
  79.  
  80. document.body.appendChild(popupContainer);
  81. }
  82.  
  83.  
  84. function scrollBox(element) {
  85. let scrollInterval = setInterval(function() {
  86. if (scrolling==true){
  87. element.scrollBy(0, 1000); // Scrolls down by 1000px
  88. }
  89. }, 500);
  90.  
  91. let checkScrollInterval = setInterval(function() {
  92. if (scrolling==false) {
  93. clearInterval(scrollInterval);
  94. clearInterval(checkScrollInterval);
  95. console.log("Scrolling finished.");
  96. }
  97. }, 500); // Check every second
  98. }
  99.  
  100. function startScrolling() {
  101. // AUTOSCROLLING OBSERVER
  102. let start_button = document.getElementById("my-autoscrolling-button");
  103.  
  104. if(scrolling==false){
  105. console.log("Scrolling started.");
  106. const observer = new MutationObserver(mutations => {
  107. if(document.querySelector('div.x1rife3k')){scrollBox(document.querySelector('div.x1rife3k'));}
  108. });
  109. observer.observe(document.body, { childList: true, subtree: true });
  110. if(document.querySelector('div.x1rife3k')){scrollBox(document.querySelector('div.x1rife3k'));}
  111.  
  112. scrolling=true;
  113. start_button.textContent = "Scrolling❌";
  114. start_button.style.backgroundColor = "darkorange";
  115. }else{
  116. scrolling=false;
  117. start_button.textContent = "Scroll🔄";
  118. start_button.style.backgroundColor = "green";
  119. }
  120. }
  121.  
  122.  
  123. createPopupButtons();
  124. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址