dfreelon / pyktok

A simple module to collect video, text, and metadata from Tiktok.
BSD 3-Clause "New" or "Revised" License
335 stars 44 forks source link

Just downloading Metadate doesnt work anymore. #36

Closed Dedeham closed 5 months ago

Dedeham commented 10 months ago

After updating it seems like the feature of just downloading the metadata of a video doesnt work.

I used this: pyk.save_tiktok("https://www.tiktok.com/@vaex.edits/video/7278224599261777185?is_from_webapp=1&sender_device=pc&web_id=7295861439716460064", False,'video_data.csv','chrome')

dfreelon commented 10 months ago

After looking into this, I'm seeing that for me, TT doesn't store nearly as much metadata in its video pages using the new data storage format denoted by __UNIVERSAL_DATA_FOR_REHYDRATION__. However on my pages I still see the original format denoted by SIGI_STATE which contains all the expected metadata. So from that I conclude that different users will see different results depending on which data package they get.

For your case, I would check the page source to see if the string 'SIGI_STATE' is present; since metadata isn't working for you I'm guessing it's not. If that's the case, someone will need to rewrite pyktok's metadata-saving code to function properly with the new data package, which I'm not seeing. (The existing code attempts to do this but references a JSON key that is absent for me.) I'll leave this open until the situation is resolved.

Dedeham commented 10 months ago

using the same call i keep on getting the same error: `tt_video_url = tt_json["__DEFAULT_SCOPE__"]['webapp.video-detail']['itemInfo']['itemStruct']['video']['downloadAddr']


KeyError: 'downloadAddr'`
dfreelon commented 10 months ago

Yeah, 'webapp.video-detail' doesn't exist for me, but I have SIGI_STATE so the old way still works for me. I suggest you explore that JSON object to see if the data you want are in there--there's no guarantee you and I will see the same content.

dfreelon commented 5 months ago

This works as of today, so closing.