Did TikTok-Api use Selenium to scrape Tiktok's data? #428
-
Hey David, I'm wondering a question. In the module tiktok.py and in the getData(self) method, I saw that you create a Request with an url like |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I do use a headless browser (similar to selenium or selenium if you pass use_selenium=True to the constructor) to generate a signature parameter for the URL. This allows the browser to make that request. You're able to find this in your own browser if you end up going to one of TikTok's sites on your desktop like #funny and hit f12 on chrome, and go to the network tab in the developer console. From there you can refresh and hit control + f and type in the search box for item_list. This will show you the data TikTok returns from the API. There's some other strange URL parameters required which the package adds onto and calculates in the case of the _signature parameter. It does this by launching playwright (similar to selenium) and uses some javascript code to calculate this _signature value which takes into account the browser's user agent, and a few other things. |
Beta Was this translation helpful? Give feedback.
-
Hi @davidteather |
Beta Was this translation helpful? Give feedback.
I do use a headless browser (similar to selenium or selenium if you pass use_selenium=True to the constructor) to generate a signature parameter for the URL. This allows the browser to make that request.
You're able to find this in your own browser if you end up going to one of TikTok's sites on your desktop like #funny and hit f12 on chrome, and go to the network tab in the developer console. From there you can refresh and hit control + f and type in the search box for item_list. This will show you the data TikTok returns from the API.
There's some other strange URL parameters required which the package adds onto and calculates in the case of the _signature parameter.
It does this by lau…