networkdynamics / pytok

A web scraper for TikTok using Playwright
59 stars 6 forks source link

Exception: Could not find __NEXT_DATA__ or SIGI_STATE #3

Closed xiari0703 closed 8 months ago

xiari0703 commented 9 months ago

i was run video_example.py , looks like something changed with tt html ?

bendavidsteel commented 9 months ago

Could you share the error you're getting?

EnzoRobaina commented 9 months ago

Could you share the error you're getting?

The exception is raised after iterating over a user's videos:

async with PyTok() as api:
        user = api.user(username="therock")
        user_data = await user.info()
        print(user_data)

        videos = []
        async for video in user.videos():
            video_data = await video.info() # << here
            print(video_data)

The raised exception comes from helpers.py at line 30

raise Exception("Could not find __NEXT_DATA__ or SIGI_STATE")

It seems like these tags are not present in the HTML, as if something has been updated. By searching for these script ids on the DOM, they are not present

image

bendavidsteel commented 9 months ago

Okay I encountered this issue for a few user pages, but I've made a few changes to the user videos code and it seems to be working better for me. Could you try again?

bendavidsteel commented 9 months ago

Okay this is now also fixed for video_example.py!