| 99 | if (!(type in CACHED)) throw Error(`Invalid type: ${type}`); |
| 100 | |
| 101 | async function _getFollow(uid, end_cursor) { |
| 102 | let url = new URL("https://www.instagram.com/graphql/query/"); |
| 103 | Object.entries({ |
| 104 | query_hash: CACHED[type].hash, |
| 105 | variables: JSON.stringify({ |
| 106 | id: uid, |
| 107 | after: end_cursor || "", |
| 108 | first: 50, |
| 109 | }), |
| 110 | }).forEach(([k, v]) => url.searchParams.append(k, v)); |
| 111 | |
| 112 | let res = await fetch(url, { |
| 113 | headers: { |
| 114 | "Content-Type": "application/x-www-form-urlencoded", |
| 115 | "X-CSRFToken": csrftoken, |
| 116 | "x-requested-with": "XMLHttpRequest", |
| 117 | "x-instagram-ajax": 1, |
| 118 | }, |
| 119 | }); |
| 120 | return await res.json(); |
| 121 | } |
| 122 | |
| 123 | let cursor = ""; |
| 124 | let total = 0; |