carcabot / tiktok-signature

Generate tiktok signature token using node
733 stars 283 forks source link

signature does't work now for user-videos #168

Closed xulei324 closed 1 year ago

xulei324 commented 1 year ago

signature does't work now for user-videos

xulei324 commented 1 year ago

a few hours ago

vdemay commented 1 year ago

Same on my side

brucekasinsky commented 1 year ago

same here

carcabot commented 1 year ago

Hi there, It seems that Tiktok changed something on their signature in the last days, this should be fixed easily by updating TT_REQ_PERM_URL along with it's TT_REQ_USER_AGENT. Check this commit

vdemay commented 1 year ago

I've made several tests with TT_REQ_USER_AGENT and TT_REQ_PERM_URL from Chrome web browser. It works for a small amount of time. Then a captcha is quickly displayed on tiktok side leading to an emtpy list of post.

Any advices?

vdemay commented 1 year ago

Using the new example js modified with this commit https://github.com/carcabot/tiktok-signature/commit/9d5ba078b17635e8e7ad4c077359773629577d7e still does not work on my side.

I suppose some parameters are valid only for a short amount of time.

node ./user-videos.js returns an empty response from tiktok

carcabot commented 1 year ago

Hi @vdemay ,

I have updated the file in order to work as expected.

I don't believe that perma links are expiring, most probably when Tiktok sign algo is changed old links are not working anymore so you have to update this periodically.

Basically you have to provide a valid URL along with it's user agent from the network traffic exactly like in this commit.

ckosmic commented 1 year ago

What's your process for getting the perma URL? I noticed some query params are empty such as referer and secUid, and root_referer is missing from the URL you provided, but are present in the URL given in the Chrome networking tab in dev tools. If I use the URL I receive from Chrome and adjust the user agent accordingly, the request fails.

This is the URL: https://us.tiktok.com/api/user/detail/?aid=1988&app_language=en&app_name=tiktok_web&battery_info=0.94&browser_language=en-US&browser_name=Mozilla&browser_online=true&browser_platform=Win32&browser_version=5.0%20%28Windows%20NT%2010.0%3B%20Win64%3B%20x64%29%20AppleWebKit%2F537.36%20%28KHTML%2C%20like%20Gecko%29%20Chrome%2F107.0.0.0%20Safari%2F537.36&channel=tiktok_web&cookie_enabled=true&device_id=7157091000690361899&device_platform=web_pc&focus_state=true&from_page=user&history_len=3&is_fullscreen=false&is_page_visible=true&language=en&os=windows&priority_region=&referer=https%3A%2F%2Fwww.tiktok.com%2F%40lizzo&region=US&root_referer=https%3A%2F%2Fwww.tiktok.com%2F%40lizzo&screen_height=1067&screen_width=1707&secUid=MS4wLjABAAAAbDLA4RLGE_qKD2V_5xJU7QiC19CS6JLNQEqcDiwOuymSFxXgq8vFmOzAjb47Zict&tz_name=America%2FLos_Angeles&uniqueId=lizzo&webcast_language=en&msToken=elNV2vEYRJ3H3ZJkwCj06OrPzo4mYQaC-WiwfeeYaWiAGDRCLO5O-JO1rH9Yfj7x_aLkTrPByB2dEr8-t-Fdj3H_vXz5pt9cXpMTWaRARGMOR-dcgfKRPxCVax1n48Q=&X-Bogus=DFSzswVO4kJANGrzSp1D52XyYJUk&_signature=_02B4Z6wo00001TFk2LQAAIDAEsX2G508G50xZNwAAC.b66 And the user agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36