davidteather / TikTok-Api

The Unofficial TikTok API Wrapper In Python
https://davidteather.github.io/TikTok-Api
MIT License
4.91k stars 984 forks source link

[BUG] 200 response code for trending video #41

Closed reteps closed 4 years ago

reteps commented 4 years ago

Describe the bug

The request to "https://m.tiktok.com/share/item/list?secUid=&id=&type=5&count=30&minCursor=0&maxCursor=0&shareUid=&_signature=" + self.signature always results in a 200 code

The buggy code

The trending video call

trending = api.trending(count=30)
        url = "https://m.tiktok.com/share/item/list?secUid=&id=&type=5&count=30&minCursor=0&maxCursor=0&shareUid=&_signature=" + self.signature
        r = requests.get(url, headers={"method": "GET",
                                       "accept-encoding": "gzip, deflate, br",
                                       "Referer": self.referer,
                                       "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1"}
                         )

        data = r.json()
        response = []
        if data["statusCode"] == 0:
            # run code
       elif data['statusCode'] == 200:
           print('error')

Expected behavior

Earlier today, it was working earlier but it suddenly stopped working. Possibly they are rate limiting me based on IP, but I was not sure.

Desktop (please complete the following information):

issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.99. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

davidteather commented 4 years ago

It's a quite buggy API because it's not official. It takes a good amount of requests to actually get a valid response. It's quite possible they blocked your IP in some way, but I've made a ton of requests while making this API and TikTok has not blocked or limited my IP in anyway yet.

Are you able to put a proxy onto windows to test if that fixes it?

davidteather commented 4 years ago

Fixed this issue he was using a delay