spencerwooo / substats

( `д′) how many followers do i have? how many!
https://substats.swo.moe
MIT License
823 stars 55 forks source link

Instagram API strikes #33

Closed ArvinZJC closed 2 years ago

ArvinZJC commented 2 years ago

Instagram has restricted using the unpublic user info API to retrieve a user's follower count (i.e., fetch from https://www.instagram.com/<username>/?__a=1 directly). By investigation, the restriction makes accessing the specific URL without a cookie redirect to the login page. Hence, the primary workaround is to extract a cookie if necessary and append the specific header with the cookie.

I would recommend taking advantage of KV. Explicit speaking, the cookie is extracted via a login API (inspired by instagram-user-feed) and stored in KV. If it is already stored, Substats should omit this step. Then, the user info API is still used but with enhanced logic. Since we are actually fighting against Instagram, let's name it "Plan Rebel". We need to know that this workaround has the following limits: