-
Notifications
You must be signed in to change notification settings - Fork 368
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
Fixed tiktok.py #14
Fixed tiktok.py #14
Conversation
The JSON formatting of the response changed, corrected. #TESTING Successfully downloaded and played a tiktok video
Will have a look as soon as I am on the computer :) |
Hmm. tiktok is now returning a 403 Forbidden when trying to access the video directly.
The yt-dlc JSON is:
The page raw JSON is:
|
Maybe some header related issues again? |
maybe, this would be helpful. However, I'm not sure how to test if it works. https://github.com/onemanbuilds/TikTokVideoDownloader |
Thanks for the link! |
That is actually using the same JSON that yt-dlc is, same KeyError if you run it unedited. |
hm.. maybe passing cookies file (or cookie header) from each session would help. I've tried adding various user-agent headers, but that did not help. |
So, seems that I've got it working! If cookies are passed it works in 100% of cases. I did the following - opened TikTok link in Chrome, then created cookies.txt file with a help of this extension: Then just passed it to ytdlc with --cookies. Guess, this should be tested more and I have no idea how to implement it inside TikTok.py. Maybe somehow grab cookies on the fly and then pass those along when sending a "download" request. |
Confirmed, using cookies it does work 100% of the time. I didn't even need to sign-in. |
I'm not overly familiar with all of the various extractors, but it doesn't look like any of them auto-grab cookies. Best next approach would be to require cookies, and raise an ExtractorError if cookies aren't supplied. |
Also, inspected headers for request URL and found cookie header. So, it also works like this: ytdlc --add-header Cookie:"tt_webid=6887613038293124613; tt_webid_v2=6887613038293124613; MONITOR_WEB_ID=7f640e08-87be-42e5-a556-872feb013f61; s_v_web_id=verify_kgpn3pr8_qpIX4y6D_QLLu_4Q50_AVAf_3l4PZJaSctoF" https://www.tiktok.com/@charlidamelio/video/6854565358808993029 That's probably simpler than generating cookies file and more "python friendly". And you are right, no sign in needed. Fingers crossed :-) |
Actually, after rooting around a little, I did find a process used by dailymotion to capture cookies. Let me implement it and test. |
Hmm. So it's pulling the right cookies automatically, but it won't work unless I specify a cookies file, then it writes the cookies to the file and the next time I run it, the download works right. As far as I can tell, the cookies are in the cookiejar correctly. Not sure why it's not working. I'm still investigating other extractors to see if I'm missing something. |
There are sites like this being able to download no watermark highest resolution videos. But no one actually got any source code public on how to generate requests for that. Most want money for some private api. There is a way to generate requests but you need some specific values x-khronos and x-gorgon. But it seems that it's not that simple to reproduce and requires an android or ios device with a server software running to communicate. |
|
It works now with cookoes |
:skip ci all Co-authored by: FelixFrog
The JSON formatting of the response changed, corrected.
#TESTING
Successfully downloaded and played a tiktok video. Fixes #12