Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] #2062

Open
drogba72 opened this issue Nov 16, 2024 · 1 comment
Open

[BUG] #2062

drogba72 opened this issue Nov 16, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@drogba72
Copy link

Hi everyone,

Describe the bug
I'm trying to get user_id from a target

cl = Client()
user_id = cl.user_id_from_username(target)

but I get this error :

Traitement du follower: user
Status 201: JSONDecodeError in public_request (url=https://www.instagram.com/user/?__a=1&__d=dis) >>>
Status 201: JSONDecodeError in public_request (url=https://www.instagram.com/user/?__a=1&__d=dis) >>>
Status 201: JSONDecodeError in public_request (url=https://www.instagram.com/user/?__a=1&__d=dis) >>>

please, what's wrong ?

Regards ;)

@drogba72 drogba72 added the bug Something isn't working label Nov 16, 2024
@becauseimnoob
Copy link

@subzeroid

web api completely removed. This url is not up to date, a developer can look at a sample work here to give an idea https://scrapfly.io/blog/how-to-scrape-instagram/

import json
import httpx

client = httpx.Client(
    headers={
        # this is internal ID of an instegram backend app. It doesn't change often.
        "x-ig-app-id": "936619743392459",
        # use browser-like features
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36",
        "Accept-Language": "en-US,en;q=0.9,ru;q=0.8",
        "Accept-Encoding": "gzip, deflate, br",
        "Accept": "*/*",
    }
)


def scrape_user(username: str):
    """Scrape Instagram user's data"""
    result = client.get(
        f"https://i.instagram.com/api/v1/users/web_profile_info/?username={username}",
    )
    data = json.loads(result.content)
    return data["data"]["user"]

print(scrape_user("google"))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants