İnstagram ext

İnstagram yardımcı eklenti

  1. // ==UserScript==
  2. // @name İnstagram ext
  3. // @namespace Violentmonkey Scripts
  4. // @match https://www.instagram.com/*
  5. // @grant none
  6. // @version 1.5
  7. // @grant GM_addStyle
  8. // @author @mmnyldrm
  9. // @description İnstagram yardımcı eklenti
  10. // ==/UserScript==
  11.  
  12. GM_addStyle(`
  13. .menuHrefs {
  14. background-color: #fff;
  15. top: 60px;
  16. position: absolute;
  17. box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.116);
  18. padding: 20px 30px;
  19. border-radius: 10px;
  20. display: none;
  21. left: -75px;
  22. border: 1px solid #dfdfdf;
  23. width: 200px;
  24. }
  25. .menuHrefs > .link {
  26. padding: 8px 12px;
  27. font-weight: 500;
  28. font-size: 15px;
  29. display: flex;
  30. align-items: center;
  31. flex-direction: row;
  32. margin: 0px -15px;
  33. border-radius: 4px;
  34. margin-bottom: 4px;
  35. cursor: pointer;
  36. }
  37. .menuHrefs > .link:hover {
  38. background-color: #eeeeee;
  39. }
  40. .menuHrefs > .link > span {
  41. margin-left: 10px;
  42. color: #50505a;
  43. }
  44. .defBTN {
  45. padding: 0px;
  46. background-color: transparent;
  47. border-width: 0;
  48. margin: 0px;
  49. }
  50. .menuHrefs > .link.active {
  51. background-color: #5f7beb21;
  52. }
  53. .menuHrefs > .link.active:hover {
  54. background-color: #5f7beb3a;
  55. }
  56. .user_profile {
  57. display: flex;
  58. }
  59. .user_profile > img {
  60. width: 30px;
  61. height: 30px;
  62. border-radius: 100%;
  63. border: 2px solid #dddddd;
  64. }
  65. .user_name_username > .welcome {
  66. font-size: 14px;
  67. color: #5e5e5e;
  68. }
  69. .user_name_username > .name {
  70. font-weight: 600;
  71. font-size: 16px;
  72. }
  73. .line_head {
  74. font-weight: 700;
  75. font-size: 13px;
  76. color: #a3a4aa;
  77. letter-spacing: 1px;
  78. margin-bottom: 12px;
  79. }
  80. .success_btn {
  81. background-color: #5feb8e21;
  82. color: #087e1c !important;
  83. }
  84. .success_btn:hover {
  85. background-color: #5feb8e5e !important;
  86. }
  87. .s_span {
  88. color: #087e1c !important;
  89. }
  90. .ftayfur {
  91. margin-left: 10px;
  92. position: relative;
  93. }
  94. .unfollow_area {
  95. width: 100%;
  96. background-color: #ffffff;
  97. box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.116);
  98. border: 1px solid #dfdfdf;
  99. padding: 20px 30px;
  100. margin-bottom: 40px;
  101. border-radius: 5px;
  102. }
  103. .total_list {
  104. font-size: 15px;
  105. font-weight: 500;
  106. display: flex;
  107. flex-direction: row;
  108. }
  109. .total_list > span {
  110. font-weight: 700;
  111. font-size: 18px;
  112. margin-bottom: 10px;
  113. }
  114. .flexbtn {
  115. margin-bottom: 10px;
  116. display: flex;
  117. flex-direction: row;
  118. }
  119. .flexbtn > button {
  120. border-width: 0;
  121. background-color: #3aad73;
  122. padding: 10px 20px;
  123. border-radius: 5px;
  124. font-weight: 500;
  125. cursor: pointer;
  126. color: #fff;
  127. margin-right: 10px;
  128. }
  129. .flexbtn > button:first-child {
  130. background-color: #4679d8;
  131. }
  132. #unfollowliststop {
  133. background-color: #ad5a3a;
  134. }
  135. .log {
  136. max-height: 200px;
  137. overflow-y: auto;
  138. }
  139. .item {
  140. font-family: "Inter", sans-serif;
  141. display: flex;
  142. flex-direction: row;
  143. }
  144. .successItem {
  145. margin-right: 5px;
  146. color: #087e1c;
  147. }
  148. .item > b {
  149. margin-right: 5px;
  150. }
  151. .modal {
  152. width: 100%;
  153. height: 100vh;
  154. position: absolute;
  155. top: 0;
  156. background-color: #616161b8;
  157. display: flex;
  158. flex-direction: column;
  159. align-items: center;
  160. justify-content: center;
  161. z-index: 222222222222;
  162. }
  163. .settings {
  164. width: 400px;
  165. background-color: #fff;
  166. border: 1px solid #eee;
  167. border-radius: 4px;
  168. }
  169. .settings > header {
  170. display: flex;
  171. flex-direction: row;
  172. justify-content: space-between;
  173. align-items: center;
  174. font-weight: 500;
  175. font-size: 18px;
  176. padding: 10px 20px;
  177. border-bottom: 1px solid #eeeeee;
  178. }
  179. .settings > header > button {
  180. border-width: 0;
  181. background-color: #dddddd63;
  182. padding: 7px 7px;
  183. display: flex;
  184. flex-direction: row;
  185. align-items: center;
  186. border-radius: 4px;
  187. }
  188. .settings > header > button:hover {
  189. background-color: #ddddddc0;
  190. cursor: pointer;
  191. }
  192. .menu_set {
  193. padding: 10px 20px;
  194. }
  195. .menu_set > h4 {
  196. font-size: 16px;
  197. font-weight: 600;
  198. margin: 0px;
  199. margin-bottom: 5px !important;
  200. }
  201. .menu_set > p {
  202. font-size: 13px;
  203. margin-top: 0px;
  204. margin-bottom: 10px;
  205. }
  206. .menu_set > input {
  207. width: calc(100% - 30px);
  208. border: 1px solid #dddddd;
  209. padding: 10px 15px;
  210. outline: none;
  211. border-radius: 4px;
  212. }
  213. .settings > .save {
  214. width: calc(100% - 40px);
  215. background-color: #5f68eb;
  216. color: #fff;
  217. margin: 10px 20px;
  218. padding: 10px 0px;
  219. border-radius: 5px;
  220. border-width: 0;
  221. cursor: pointer;
  222. }
  223. .settings > .save:hover {
  224. background-color: #4c56e4;
  225. }
  226. .success_modal {
  227. text-align: center;
  228. width: calc(100% - 40px);
  229. margin: 0px 20px;
  230. margin-bottom: 10px;
  231. padding: 10px 0px;
  232. background-color: #15b86c23;
  233. color: #127245;
  234. border-radius: 5px;
  235. }
  236. #ucount, #yucount {
  237. margin-left: 15px;
  238. }
  239. `);
  240.  
  241. const URL_USER_INFO = "https://www.instagram.com/*/?__a=1";
  242. const URL_HOME = "https://www.instagram.com/";
  243. const URL_UNFOLLOW =
  244. "https://www.instagram.com/web/friendships/*/unfollow/";
  245. const URL_FOLLOW =
  246. "https://www.instagram.com/web/friendships/*/follow/";
  247. const URL_LIKE = "https://www.instagram.com/web/likes/*/like/";
  248.  
  249. let currentUrl = document.location.href;
  250. let otherUserName;
  251. let userId;
  252. let actionTime =
  253. parseInt(localStorage.getItem("hiz_saniye")) || 3000;
  254. const _cookies = document.cookie.split(";");
  255. const _csrftoken = _cookies
  256. .find((item) => item.includes("csrftoken"))
  257. .replace(" csrftoken=", "");
  258. const _userId = _cookies
  259. .find((item) => item.includes("ds_user_id"))
  260. .replace(" ds_user_id=", "");
  261. const success_color = "#087e1c";
  262. const inActiveColor = "#bbbcc1";
  263. const successClass = "success_btn";
  264. let unfollow_list = new Array();
  265. let like_list = new Array();
  266. let follow_list = new Array();
  267. let unfollowCursor = 0;
  268. let followCursor = 0;
  269. let likeCursor = 0;
  270. let valueChange = actionTime;
  271.  
  272. const likeIsSuccess = (successVal, failVal) => {
  273. const url = "https://www.instagram.com/";
  274. if (currentUrl === url) {
  275. return successVal;
  276. }
  277. return failVal;
  278. };
  279.  
  280. let free = [];
  281. let unfollow_count = 0;
  282. let follow_count = 0;
  283. let like_count = 0;
  284. const successMessage =
  285. '<div class="item"><span class="successItem">Başarılı - </span> <b>*/name*/ </b> */message*/</div>';
  286. const errorMessage =
  287. '<div class="item"><span class="errItem">Hata - </span> <b>*/type*/ </b> */message*/</div>';
  288.  
  289. const openOrCloseMenu = () => {
  290. const menuList = document.getElementById("menu_list");
  291. const isShow = menuList.dataset.show === "true";
  292. const styleMenu = menuList.style;
  293. if (isShow) {
  294. styleMenu.display = "none";
  295. menuList.setAttribute("data-show", "false");
  296. } else {
  297. styleMenu.display = "block";
  298. menuList.setAttribute("data-show", "true");
  299. }
  300. };
  301.  
  302. const setMenu = () => {
  303. const className = document.getElementsByClassName("_47KiJ");
  304. const createElementDiv = document.createElement("div");
  305. createElementDiv.className = "ftayfur";
  306. createElementDiv.innerHTML = `<div class="ftayfur"><a id="menu_btn" class="_0ZPOP kIKUG ">
  307. <svg class="_8-yf5 " xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22" width="22" height="22">
  308. <path fill="none" d="M0 0h24v24H0z"/>
  309. <path d="M3 4h18v2H3V4zm0 7h12v2H3v-2zm0 7h18v2H3v-2z"/>
  310. </svg>
  311. </a>
  312. <div data-show="false" id="menu_list" class="menuHrefs">
  313. <h4 class="line_head">İşlemler</h4>
  314. <div id="follow_btn" class="link ">
  315. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="22" height="22">
  316. <path fill="none" d="M0 0h24v24H0z"/>
  317. <path fill="${inActiveColor}" d="M14 14.252v2.09A6 6 0 0 0 6 22l-2-.001a8 8 0 0 1 10-7.748zM12 13c-3.315 0-6-2.685-6-6s2.685-6 6-6 6 2.685 6 6-2.685 6-6 6zm0-2c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm5.793 8.914l3.535-3.535 1.415 1.414-4.95 4.95-3.536-3.536 1.415-1.414 2.12 2.121z"/>
  318. </svg>
  319. <span>Takip</span>
  320. </div>
  321. <div id="unfollow_btn" class="link">
  322. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="22" height="22">
  323. <path fill="none" d="M0 0h24v24H0z"/>
  324. <path fill="#bbbcc1" d="M14 14.252v2.09A6 6 0 0 0 6 22l-2-.001a8 8 0 0 1 10-7.748zM12 13c-3.315 0-6-2.685-6-6s2.685-6 6-6 6 2.685 6 6-2.685 6-6 6zm0-2c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm7 6.586l2.121-2.122 1.415 1.415L20.414 19l2.122 2.121-1.415 1.415L19 20.414l-2.121 2.122-1.415-1.415L17.586 19l-2.122-2.121 1.415-1.415L19 17.586z"/>
  325. </svg>
  326. <span>Unfollow</span>
  327. </div>
  328. <div id="like_btn" class="link">
  329. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="22" height="22">
  330. <path fill="none" d="M0 0h24v24H0z"/>
  331. <path fill="${inActiveColor}" d="M16.5 3C19.538 3 22 5.5 22 9c0 7-7.5 11-10 12.5C9.5 20 2 16 2 9c0-3.5 2.5-6 5.5-6C9.36 3 11 4 12 5c1-1 2.64-2 4.5-2zm-3.566 15.604c.881-.556 1.676-1.109 2.42-1.701C18.335 14.533 20 11.943 20 9c0-2.36-1.537-4-3.5-4-1.076 0-2.24.57-3.086 1.414L12 7.828l-1.414-1.414C9.74 5.57 8.576 5 7.5 5 5.56 5 4 6.656 4 9c0 2.944 1.666 5.533 4.645 7.903.745.592 1.54 1.145 2.421 1.7.299.189.595.37.934.572.339-.202.635-.383.934-.571z"/>
  332. </svg>
  333. <span>Like</span>
  334. </div>
  335. <div id="setting_btn" class="link success_btn">
  336. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="22" height="22">
  337. <path fill="none" d="M0 0h24v24H0z"/>
  338. <path fill="${success_color}" d="M3.34 17a10.018 10.018 0 0 1-.978-2.326 3 3 0 0 0 .002-5.347A9.99 9.99 0 0 1 4.865 4.99a3 3 0 0 0 4.631-2.674 9.99 9.99 0 0 1 5.007.002 3 3 0 0 0 4.632 2.672c.579.59 1.093 1.261 1.525 2.01.433.749.757 1.53.978 2.326a3 3 0 0 0-.002 5.347 9.99 9.99 0 0 1-2.501 4.337 3 3 0 0 0-4.631 2.674 9.99 9.99 0 0 1-5.007-.002 3 3 0 0 0-4.632-2.672A10.018 10.018 0 0 1 3.34 17zm5.66.196a4.993 4.993 0 0 1 2.25 2.77c.499.047 1 .048 1.499.001A4.993 4.993 0 0 1 15 17.197a4.993 4.993 0 0 1 3.525-.565c.29-.408.54-.843.748-1.298A4.993 4.993 0 0 1 18 12c0-1.26.47-2.437 1.273-3.334a8.126 8.126 0 0 0-.75-1.298A4.993 4.993 0 0 1 15 6.804a4.993 4.993 0 0 1-2.25-2.77c-.499-.047-1-.048-1.499-.001A4.993 4.993 0 0 1 9 6.803a4.993 4.993 0 0 1-3.525.565 7.99 7.99 0 0 0-.748 1.298A4.993 4.993 0 0 1 6 12c0 1.26-.47 2.437-1.273 3.334a8.126 8.126 0 0 0 .75 1.298A4.993 4.993 0 0 1 9 17.196zM12 15a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"/>
  339. </svg>
  340. <span class="s_span">Ayarlar</span>
  341. </div>
  342. </div>
  343. </div>`;
  344.  
  345. if (className) {
  346. for (var i = 0; i < className.length; i++) {
  347. className[i].appendChild(createElementDiv);
  348. }
  349. }
  350.  
  351. if (document.getElementById("menu_btn")) {
  352. document
  353. .getElementById("menu_btn")
  354. .addEventListener("click", (event) => {
  355. openOrCloseMenu();
  356. });
  357. }
  358.  
  359. if (document.getElementById("setting_btn")) {
  360. document
  361. .getElementById("setting_btn")
  362. .addEventListener("click", (event) => {
  363. openOrCloseMenu();
  364. const mainReactArea = document.getElementById(
  365. "react-root",
  366. );
  367. const createUnModalDiv = document.createElement("div");
  368. createUnModalDiv.className = "modal";
  369. createUnModalDiv.setAttribute("id", "modal_close");
  370. createUnModalDiv.innerHTML = `
  371. <div id="setNoti" class="settings">
  372. <header>
  373. Ayarlar
  374. <button id="close_set">
  375. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
  376. <path fill="none" d="M0 0h24v24H0z"/>
  377. <path fill="#818181" d="M12 10.586l4.95-4.95 1.414 1.414-4.95 4.95 4.95 4.95-1.414 1.414-4.95-4.95-4.95 4.95-1.414-1.414 4.95-4.95-4.95-4.95L7.05 5.636z"/>
  378. </svg>
  379. </button>
  380. </header>
  381. <div class="menu_set">
  382. <h4>İşlem hızı</h4>
  383. <p>Saniye başına yapılacak işlem hızı <b>Mili saniye cinsinden</b></p>
  384. <input id="change_second" type="number" value="${actionTime}" placeholder="3 ( saniye ) * 1000 ( milisaniye ) = 3000" />
  385. </div>
  386. <button id="save_set" class="save">Kayıt et</button>
  387. </div>`;
  388.  
  389. if (mainReactArea) {
  390. mainReactArea.appendChild(createUnModalDiv);
  391. }
  392.  
  393. if (document.getElementById("close_set")) {
  394. document
  395. .getElementById("close_set")
  396. .addEventListener("click", () => {
  397. document.getElementById("modal_close").remove();
  398. });
  399. }
  400.  
  401. if (document.getElementById("save_set")) {
  402. document
  403. .getElementById("save_set")
  404. .addEventListener("click", (e) => {
  405. const mainMArea = document.getElementById(
  406. "setNoti",
  407. );
  408. const createUnSuccessDiv = document.createElement(
  409. "div",
  410. );
  411. createUnSuccessDiv.className = "success_modal";
  412. createUnSuccessDiv.setAttribute(
  413. "id",
  414. "successMessage",
  415. );
  416.  
  417. const newTime = parseInt(
  418. document.getElementById("change_second").value,
  419. );
  420. actionTime = newTime;
  421. localStorage.setItem("hiz_saniye", newTime);
  422. createUnSuccessDiv.innerHTML += "Kayıt başarılı";
  423.  
  424. if (mainMArea) {
  425. mainMArea.appendChild(createUnSuccessDiv);
  426. }
  427. setTimeout(
  428. () =>
  429. document
  430. .getElementById("successMessage")
  431. .remove(),
  432. 3000,
  433. );
  434. });
  435. }
  436. });
  437. }
  438.  
  439. if (document.getElementById("like_btn")) {
  440. document
  441. .getElementById("like_btn")
  442. .addEventListener("click", (event) => {
  443. openOrCloseMenu();
  444. const mainArea = document.getElementsByClassName(
  445. "cGcGK",
  446. );
  447. const createUnfollowDiv = document.createElement("div");
  448. createUnfollowDiv.innerHTML = `
  449. <div class="unfollow_area">
  450. <div class="flexbtn">
  451. <button id="unfollowlistadd">LİSTE EKLE</button>
  452. <button id="unfollowliststop">DURDUR</button>
  453. <button id="unf_go">BAŞLAT</button>
  454. </div>
  455. <div class="total_list">toplam like listesi: <span id="ucount">${like_list.length}</span></div>
  456. <div class="total_list">toplam like edilen post: <span id="yucount">${like_count}</span></div>
  457. <div id="log_unf" class="log"></div>
  458. </div>`;
  459.  
  460. if (mainArea) {
  461. mainArea[0].insertBefore(
  462. createUnfollowDiv,
  463. mainArea[0].childNodes[0],
  464. );
  465. }
  466. if (document.getElementById("unfollowlistadd")) {
  467. const setLikeList = () => {
  468. fetch(
  469. `https://www.instagram.com/graphql/query/?query_hash=e3ae866f8b31b11595884f0c509f3ec5&variables={"cached_feed_item_ids":[],"fetch_media_item_count":12,"fetch_comment_count":4,"fetch_like":3,"has_stories":false,"has_threaded_comments":true ${
  470. likeCursor
  471. ? ',"fetch_media_item_cursor": "' +
  472. likeCursor +
  473. '"'
  474. : ""
  475. }}`,
  476. )
  477. .then((responseJson) => responseJson.json())
  478. .then((responseJson) => {
  479. const newList =
  480. responseJson.data.user.edge_web_feed_timeline
  481. .edges;
  482. if (
  483. likeCursor !== null &&
  484. like_list.length <= 80
  485. ) {
  486. like_list = like_list.concat(newList);
  487. likeCursor =
  488. responseJson.data.user.edge_web_feed_timeline
  489. .page_info.end_cursor;
  490. }
  491. });
  492.  
  493. setTimeout(
  494. () =>
  495. (document.getElementById("ucount").innerHTML =
  496. like_list.length),
  497. 500,
  498. );
  499. };
  500.  
  501. document
  502. .getElementById("unfollowlistadd")
  503. .addEventListener("click", (event) => {
  504. var myVar = setInterval(setLikeList, 1000);
  505. document
  506. .getElementById("unfollowliststop")
  507. .addEventListener("click", (event) => {
  508. clearInterval(myVar);
  509. });
  510. });
  511. document
  512. .getElementById("unf_go")
  513. .addEventListener("click", (event) => {
  514. like_list.map((item, index) =>
  515. setTimeout(
  516. () => ActionLike(item),
  517. actionTime * (index + 1),
  518. ),
  519. );
  520. });
  521. }
  522. });
  523. }
  524.  
  525. if (document.getElementById("follow_btn")) {
  526. document
  527. .getElementById("follow_btn")
  528. .addEventListener("click", (event) => {
  529. openOrCloseMenu();
  530. const mainArea = document.getElementsByClassName(
  531. "v9tJq",
  532. );
  533. const createUnfollowDiv = document.createElement("div");
  534. createUnfollowDiv.innerHTML = `
  535. <div class="unfollow_area">
  536. <div class="flexbtn">
  537. <button id="unfollowlistadd">LİSTE EKLE</button>
  538. <button id="unfollowliststop">DURDUR</button>
  539. <button id="unf_go">BAŞLAT</button>
  540. </div>
  541. <div class="total_list">toplam takip listesi: <span id="ucount">${unfollow_list.length}</span></div>
  542. <div class="total_list">toplam takip edilen kullanıcı: <span id="yucount">${unfollow_count}</span></div>
  543. <div id="log_unf" class="log"></div>
  544. </div>`;
  545.  
  546. if (mainArea) {
  547. mainArea[0].insertBefore(
  548. createUnfollowDiv,
  549. mainArea[0].childNodes[0],
  550. );
  551. }
  552.  
  553. if (document.getElementById("unfollowlistadd")) {
  554. const setfollowList = () => {
  555. fetch(
  556. `https://www.instagram.com/graphql/query/?query_hash=c76146de99bb02f6415203be841dd25a&variables={"id":${userId},"include_reel":true,"fetch_mutual":false,"first":20 ${
  557. followCursor
  558. ? ',"after": "' + followCursor + '"'
  559. : ""
  560. }}`,
  561. )
  562. .then((responseJson) => responseJson.json())
  563. .then((responseJson) => {
  564. const newList =
  565. responseJson.data.user.edge_followed_by.edges;
  566. newList.map((item) => {
  567. fetch(
  568. URL_USER_INFO.replace(
  569. "*",
  570. item.node.username,
  571. ),
  572. )
  573. .then((responseJson) => responseJson.json())
  574. .then((responseJson) => {
  575. const takip_ediliyor =
  576. responseJson.graphql.user
  577. .followed_by_viewer;
  578. const istek_gonderildi =
  579. responseJson.graphql.user
  580. .requested_by_viewer;
  581. if (!takip_ediliyor && !istek_gonderildi) {
  582. free.push(item);
  583. }
  584. });
  585. });
  586. if (followCursor !== null) {
  587. followCursor =
  588. responseJson.data.user.edge_followed_by
  589. .page_info.end_cursor;
  590. }
  591. });
  592. if (follow_list.length <= 80) {
  593. follow_list = follow_list.concat(free);
  594. }
  595. setTimeout(
  596. () =>
  597. (document.getElementById("ucount").innerHTML =
  598. follow_list.length),
  599. 500,
  600. );
  601. free = [];
  602. };
  603.  
  604. document
  605. .getElementById("unfollowlistadd")
  606. .addEventListener("click", (event) => {
  607. var myVar = setInterval(setfollowList, 1000);
  608. document
  609. .getElementById("unfollowliststop")
  610. .addEventListener("click", (event) => {
  611. clearInterval(myVar);
  612. });
  613. });
  614. document
  615. .getElementById("unf_go")
  616. .addEventListener("click", (event) => {
  617. follow_list.map((item, index) =>
  618. setTimeout(
  619. () => ActionFollow(item),
  620. actionTime * (index + 1),
  621. ),
  622. );
  623. });
  624. }
  625. });
  626. }
  627.  
  628. if (document.getElementById("unfollow_btn")) {
  629. document
  630. .getElementById("unfollow_btn")
  631. .addEventListener("click", (event) => {
  632. openOrCloseMenu();
  633. const mainArea = document.getElementsByClassName(
  634. "v9tJq",
  635. );
  636. const createUnfollowDiv = document.createElement("div");
  637. createUnfollowDiv.innerHTML = `
  638. <div class="unfollow_area">
  639. <div class="flexbtn">
  640. <button id="unfollowlistadd">LİSTE EKLE</button>
  641. <button id="unfollowliststop">DURDUR</button>
  642. <button id="unf_go">BAŞLAT</button>
  643. </div>
  644. <div class="total_list">toplam unfollow listesi: <span id="ucount">${unfollow_list.length}</span></div>
  645. <div class="total_list">toplam unfollow edilen kullanıcı: <span id="yucount">${unfollow_count}</span></div>
  646. <div id="log_unf" class="log"></div>
  647. </div>`;
  648.  
  649. if (mainArea) {
  650. mainArea[0].insertBefore(
  651. createUnfollowDiv,
  652. mainArea[0].childNodes[0],
  653. );
  654. }
  655.  
  656. if (document.getElementById("unfollowlistadd")) {
  657. const setUnfollowList = () => {
  658. fetch(
  659. `https://www.instagram.com/graphql/query/?query_hash=d04b0a864b4b54837c0d870b0e77e076&variables={"id":${userId},"include_reel":true,"fetch_mutual":false,"first":20 ${
  660. unfollowCursor
  661. ? ',"after": "' + unfollowCursor + '"'
  662. : ""
  663. }}`,
  664. )
  665. .then((responseJson) => responseJson.json())
  666. .then((responseJson) => {
  667. const newList =
  668. responseJson.data.user.edge_follow.edges;
  669. if (
  670. unfollowCursor !== null &&
  671. unfollow_list.length <= 80
  672. ) {
  673. unfollow_list = unfollow_list.concat(newList);
  674. unfollowCursor =
  675. responseJson.data.user.edge_follow.page_info
  676. .end_cursor;
  677. }
  678. });
  679. setTimeout(
  680. () =>
  681. (document.getElementById("ucount").innerHTML =
  682. unfollow_list.length),
  683. 500,
  684. );
  685. };
  686.  
  687. document
  688. .getElementById("unfollowlistadd")
  689. .addEventListener("click", (event) => {
  690. var myVar = setInterval(setUnfollowList, 1000);
  691. document
  692. .getElementById("unfollowliststop")
  693. .addEventListener("click", (event) => {
  694. clearInterval(myVar);
  695. });
  696. });
  697. document
  698. .getElementById("unf_go")
  699. .addEventListener("click", (event) => {
  700. unfollow_list.map((item, index) =>
  701. setTimeout(
  702. () => ActionUnfollow(item),
  703. actionTime * (index + 1),
  704. ),
  705. );
  706. });
  707. }
  708. });
  709. }
  710. };
  711.  
  712. const ActionUnfollow = (item) => {
  713. fetch(URL_UNFOLLOW.replace("*", item.node.id), {
  714. method: "POST",
  715. headers: {
  716. "x-csrftoken": _csrftoken,
  717. "x-instagram-ajax": 1,
  718. "x-requested-with": "XMLHttpRequest"
  719. },
  720. })
  721. .then((responseJson) => responseJson.json())
  722. .then((responseJson) => {
  723. const status = responseJson.status === "ok";
  724. if (status) {
  725. unfollow_count++;
  726. document.getElementById(
  727. "yucount",
  728. ).innerHTML = unfollow_count;
  729. document.getElementById(
  730. "log_unf",
  731. ).innerHTML += successMessage
  732. .replace("*/name*/", item.node.username)
  733. .replace("*/message*/", "Unfollow edildi");
  734. } else {
  735. document.getElementById(
  736. "log_unf",
  737. ).innerHTML += errorMessage
  738. .replace("*/type*/", "Limit")
  739. .replace("*/message*/", "aşımı");
  740. }
  741. })
  742. .catch((err) => {
  743. if (err) {
  744. document.getElementById(
  745. "log_unf",
  746. ).innerHTML += errorMessage
  747. .replace("*/type*/", "Limit")
  748. .replace("*/message*/", "aşımı");
  749. }
  750. });
  751. };
  752.  
  753. const ActionLike = (item) => {
  754. fetch(URL_LIKE.replace("*", item.node.id), {
  755. method: "POST",
  756. headers: {
  757. "x-csrftoken": _csrftoken,
  758. "x-instagram-ajax": 1,
  759. "x-requested-with": "XMLHttpRequest"
  760. },
  761. })
  762. .then((responseJson) => responseJson.json())
  763. .then((responseJson) => {
  764. const status = responseJson.status === "ok";
  765. if (status) {
  766. like_count++;
  767. document.getElementById(
  768. "yucount",
  769. ).innerHTML = like_count;
  770. document.getElementById(
  771. "log_unf",
  772. ).innerHTML += successMessage
  773. .replace("*/name*/", item.node.id)
  774. .replace("*/message*/", "Beğenildi");
  775. } else {
  776. document.getElementById(
  777. "log_unf",
  778. ).innerHTML += errorMessage
  779. .replace("*/type*/", "Limit")
  780. .replace("*/message*/", "aşımı");
  781. }
  782. })
  783. .catch((err) => {
  784. if (err) {
  785. document.getElementById(
  786. "log_unf",
  787. ).innerHTML += errorMessage
  788. .replace("*/type*/", "Limit")
  789. .replace("*/message*/", "aşımı");
  790. }
  791. });
  792. };
  793.  
  794. const ActionFollow = (item) => {
  795. fetch(URL_FOLLOW.replace("*", item.node.id), {
  796. method: "POST",
  797. headers: {
  798. "x-csrftoken": _csrftoken,
  799. "x-instagram-ajax": 1,
  800. "x-requested-with": "XMLHttpRequest"
  801. },
  802. })
  803. .then((responseJson) => responseJson.json())
  804. .then((responseJson) => {
  805. follow_count++;
  806. document.getElementById(
  807. "yucount",
  808. ).innerHTML = follow_count;
  809. if (responseJson.result === "requested") {
  810. document.getElementById(
  811. "log_unf",
  812. ).innerHTML += successMessage
  813. .replace("*/name*/", item.node.username)
  814. .replace("*/message*/", "İstek gönderildi");
  815. } else {
  816. document.getElementById(
  817. "log_unf",
  818. ).innerHTML += successMessage
  819. .replace("*/name*/", item.node.username)
  820. .replace("*/message*/", "Takip edildi");
  821. }
  822. })
  823. .catch((err) => {
  824. if (err) {
  825. document.getElementById(
  826. "log_unf",
  827. ).innerHTML += errorMessage
  828. .replace("*/type*/", "Limit")
  829. .replace("*/message*/", "aşımı");
  830. }
  831. });
  832. };
  833.  
  834. window.onload = () => {
  835. setMenu();
  836.  
  837. let observer = new MutationObserver(function (mutations) {
  838. mutations.forEach(function (mutation) {
  839. const btnMenu = document.getElementById("menu_btn");
  840. if (currentUrl != document.location.href && !btnMenu) {
  841. /* Changed ! your code here */
  842. currentUrl = document.location.href;
  843. setMenu();
  844. } else {
  845. if (!btnMenu) {
  846. setMenu();
  847. }
  848. }
  849. if (currentUrl !== URL_HOME) {
  850. let nowUserName = document.getElementsByClassName(
  851. "_7UhW9",
  852. )[0].innerText;
  853. if (
  854. otherUserName !== nowUserName &&
  855. nowUserName !== "Başlarken"
  856. ) {
  857. otherUserName = document.getElementsByClassName(
  858. "_7UhW9",
  859. )[0].innerText;
  860. fetch(URL_USER_INFO.replace("*", otherUserName))
  861. .then((responseJson) => responseJson.json())
  862. .then((responseJson) => {
  863. userId = responseJson.graphql.user.id;
  864. });
  865. }
  866. }
  867. });
  868. });
  869.  
  870. var bodyList = document.querySelector("body");
  871. var config = {
  872. childList: true,
  873. subtree: true,
  874. };
  875.  
  876. observer.observe(bodyList, config);
  877. };