captaincolonelfox / TeleTok

Telegram bot to download TikTok videos
https://t.me/TeleTockerBot
MIT License
48 stars 48 forks source link

TikTok(?) update now redirects video pages #17

Closed jussihi closed 2 years ago

jussihi commented 2 years ago

Hello, as with some update, TikTok seems to redirect the TeleTok user agent/cookies.

When running TeleTok with env var HTTPX_LOG_LEVEL=debug, with let's say video url: https://vm.tiktok.com/ZMRJq1M2c/ I get logs like:

DEBUG [2021-12-14 22:36:06] httpx._client - HTTP Request: GET https://vm.tiktok.com/ZMRJq1M2c/ "HTTP/1.1 301 Moved Permanently"
<a href="https://m.tiktok.com/v/6991506151049317634.html?_d=.......LONGHTMLDIDNTPASTEITALL">Moved Permanently</a>.

TeleTok is not able to process these videos. I could not get around this change, would've submitted a PR otherwise.. Hope you can fix it!

captaincolonelfox commented 2 years ago

Hi

Thank you for informing me about the issue, very much appreciate it. Just checked if my bot can handle this tiktok and seems like it's

So I have researched the error Moved Permanently and I can assume that you have the latest version of httpx library installed. They recently did an update in which you need manually set following_redirects=True to your requests.

I did this change to the code, so you can pull the latest version and check if it's fixed your issue

P.S nice tiktok, btw

изображение

jussihi commented 2 years ago

Haha, it seems like so! Come to think of it, the bot broke after I did a system upgrade on my box :) Thanks for the quick fix! Much appreciated! This can be closed now.

(ofc a nice test case needed to be inserted :-) )