carcabot / tiktok-signature

Generate tiktok signature token using node
755 stars 285 forks source link

No trendings using trending.py #165

Closed Huertas97 closed 1 year ago

Huertas97 commented 2 years ago

Describe the bug I have installed tiktok-signature and Naked dependencies, clone the repo, and run the following example to obtain TikTok trends:

$python examples/trending.py

However the output is empty because response.exitcode is always different from 0. I think it is not retrieving any information from TikTok. I don't know if it is a problem from my part or this example is not working anymore.

I'm attaching the output error:

[Running] python -u "c:\Users\Admin\OneDrive - Universidad Politécnica de Madrid\Documentos\MARTINI\TikTok\tiktok-signature\examples\trending.py"
b''
Cannot run node script:
 Exit code: 
     1  
 Standard Error: 
     b"node:internal/modules/cjs/loader:998\r\n  throw err;\r\n  ^\r\n\r\nError: Cannot find module 'c:\\Users\\Admin\\OneDrive'\r\n    at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)\r\n    at Module._load (node:internal/modules/cjs/loader:841:27)\r\n    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)\r\n    at node:internal/main/run_main_module:23:47 {\r\n  code: 'MODULE_NOT_FOUND',\r\n  requireStack: []\r\n}\r\n\r\nNode.js v18.12.0\r\n"

It is something wrong about my path? It seems that it is not loading a required module.

If fields below will be empty then issue will be Ignored and Closed

To Reproduce Steps to reproduce the behavior:

Huertas97 commented 2 years ago

Describe the bug I have installed tiktok-signature and Naked dependencies, clone the repo, and run the following example to obtain TikTok trends:

$python examples/trending.py

However the output is empty because response.exitcode is always different from 0. I think it is not retrieving any information from TikTok. I don't know if it is a problem from my part or this example is not working anymore.

I'm attaching the output error:

[Running] python -u "c:\Users\Admin\OneDrive - Universidad Politécnica de Madrid\Documentos\MARTINI\TikTok\tiktok-signature\examples\trending.py"
b''
Cannot run node script:
 Exit code: 
   1  
 Standard Error: 
   b"node:internal/modules/cjs/loader:998\r\n  throw err;\r\n  ^\r\n\r\nError: Cannot find module 'c:\\Users\\Admin\\OneDrive'\r\n    at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)\r\n    at Module._load (node:internal/modules/cjs/loader:841:27)\r\n    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)\r\n    at node:internal/main/run_main_module:23:47 {\r\n  code: 'MODULE_NOT_FOUND',\r\n  requireStack: []\r\n}\r\n\r\nNode.js v18.12.0\r\n"

It is something wrong about my path? It seems that it is not loading a required module.

If fields below will be empty then issue will be Ignored and Closed

To Reproduce Steps to reproduce the behavior:

  • Used OS: Windowd 10
  • NodeJs Version: v18.12.0
  • Signature Version
  • CLI or Module: Module
  • Do you run the tool through Proxy, VPN, VPS? --> No. Localhost
  • Preferably provide URL to the profile,hashtag,video and etc page

Update

I have run the code in a different folder location in case it was the problem. In that case the output error showed me that I needed to install playwright-chromium. So after running in shell:

npm i playwright-chromium

and running the example .py file (with print modified to read better the output response)

python .\examples\trending.py

I obtain the following output

Response stdout:
         b'{"status":"ok","data":{"signature":"_02B4Z6wo00f016St7AQAAIBAeTADMUVyzSukveiAAIp99c","verify_fp":"verify_5b161567bda98b6a50c0414d99909d4b","signed_url":"https://m.tiktok.com/api/post/item_list/?aid=1988&count=30&secUid=MS4wLjABAAAAOUoQXeHglWcq4ca3MwlckxqAe-RIKQ1zlH9NkQkbLAT_h1_6SDc4zyPdAcVdTWZF&cursor=0&verifyFp=verify_5b161567bda98b6a50c0414d99909d4b&_signature=_02B4Z6wo00f016St7AQAAIBAeTADMUVyzSukveiAAIp99c&X-Bogus=DFSzswSOIBkANVRUS/zUjnOZax-m","x-tt-params":"mb+z3Pl1d/bc+N0SKnc7nb3QUghzTPiwbDV+3XN8HaRTtr0JXAtTVnIUDTpivydJ5jkl4frk1rWltxrewy8UxPeRu9Jr7Y16B3/3NVfDAMdstYu5A/j8ty/O464zUlKXmn+QuBc3cxYCCtYyVdDL7F5WS0EN/O61UG1uxT2InAhD+0h6VWQu+Ux65eF1oDJHuVGlOw8dUtd4pXWMnW7D0mxN79BMyeyh6CNRLbo33vILILuz9lHhO8eH7Z53ckbIH5K5ECmPUq4lZsBiTc7sk+PKCxVnRVnebweMrWMg+Z/0UTAGsuSwb05Z4BalINIv","x-bogus":"DFSzswSOIBkANVRUS/zUjnOZax-m","navigator":{"deviceScaleFactor":1,"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.109 Safari/537.36","browser_language":"en-US","browser_platform":"Win32","browser_name":"Mozilla","browser_version":"5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.109 Safari/537.36"}}}\n'

Signature:
         {'status': 'ok', 'data': {'signature': '_02B4Z6wo00f016St7AQAAIBAeTADMUVyzSukveiAAIp99c', 'verify_fp': 'verify_5b161567bda98b6a50c0414d99909d4b', 'signed_url': 'https://m.tiktok.com/api/post/item_list/?aid=1988&count=30&secUid=MS4wLjABAAAAOUoQXeHglWcq4ca3MwlckxqAe-RIKQ1zlH9NkQkbLAT_h1_6SDc4zyPdAcVdTWZF&cursor=0&verifyFp=verify_5b161567bda98b6a50c0414d99909d4b&_signature=_02B4Z6wo00f016St7AQAAIBAeTADMUVyzSukveiAAIp99c&X-Bogus=DFSzswSOIBkANVRUS/zUjnOZax-m', 'x-tt-params': 'mb+z3Pl1d/bc+N0SKnc7nb3QUghzTPiwbDV+3XN8HaRTtr0JXAtTVnIUDTpivydJ5jkl4frk1rWltxrewy8UxPeRu9Jr7Y16B3/3NVfDAMdstYu5A/j8ty/O464zUlKXmn+QuBc3cxYCCtYyVdDL7F5WS0EN/O61UG1uxT2InAhD+0h6VWQu+Ux65eF1oDJHuVGlOw8dUtd4pXWMnW7D0mxN79BMyeyh6CNRLbo33vILILuz9lHhO8eH7Z53ckbIH5K5ECmPUq4lZsBiTc7sk+PKCxVnRVnebweMrWMg+Z/0UTAGsuSwb05Z4BalINIv', 'x-bogus': 'DFSzswSOIBkANVRUS/zUjnOZax-m', 'navigator': {'deviceScaleFactor': 1, 'user_agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.109 Safari/537.36', 'browser_language': 'en-US', 'browser_platform': 'Win32', 'browser_name': 'Mozilla', 'browser_version': '5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.109 Safari/537.36'}}}

Data:  b''

It seems that it is not retrieving any data. Any help would be appreciated!

carcabot commented 2 years ago

Hi there,

It seems that there are some issues at this moment with our example files. Try to get a response using cURL for the signed_url link.

curl "https://m.tiktok.com/api/post/item_list/?aid=1988&count=30&secUid=MS4wLjABAAAAOUoQXeHglWcq4ca3MwlckxqAe-RIKQ1zlH9NkQkbLAT_h1_6SDc4zyPdAcVdTWZF&cursor=0&verifyFp=verify_5b161567bda98b6a50c0414d99909d4b&_signature=_02B4Z6wo00f016St7AQAAIBAeTADMUVyzSukveiAAIp99c&X-Bogus=DFSzswSOIBkANVRUS/zUjnOZax-m"

It should work.

Huertas97 commented 2 years ago

Hi,

Thanks for the response. Maybe I'm missing something, but the content response is empty:

curl "https://m.tiktok.com/api/post/item_list/?aid=1988&count=30&secUid=MS4wLjABAAAAOUoQXeHglWcq4ca3MwlckxqAe-RIKQ1zlH9NkQkbLAT_h1_6SDc4zyPdAcVdTWZF&cursor=0&verifyFp=verify_5b161567bda98b6a50c0414d99909d4b&_signature=_02B4Z6wo00f016St7AQAAIBAeTADMUVyzSukveiAAIp99c&X-Bogus=DFSzswSOIBkANVRUS/zUjnOZax-m"

StatusCode        : 200
StatusDescription : OK
Content           :
RawContent        : HTTP/1.1 200 OK
                    X-Janus-Mini-Api-Forward:
                    Janus-Mini(fast)
                    Tt_stable: 1
                    Tt_orcas_res: 1
                    X-Tt-Logid:
                    20221031104702010214029027210C71C9
                    X-Ms-Token: vnHw278j76SPpTGFXNysDcrXbdCzP
                    thlR7r7MnYANPwoPbNv...
Forms             : {}
Headers           : {[X-Janus-Mini-Api-Forward,
                    Janus-Mini(fast)], [Tt_stable, 1],
                    [Tt_orcas_res, 1], [X-Tt-Logid,
                    20221031104702010214029027210C71C9]...}
Images            : {}
InputFields       : {}
Links             : {}
ParsedHtml        : mshtml.HTMLDocumentClass
RawContentLength  : 0
carcabot commented 2 years ago

I'm not sure what's wrong on your end but when I access the url provided in my browser it works even with the example given previously. Try using some proxies, probably your IP has been temporary blocked somehow.

Huertas97 commented 2 years ago

I'm not sure what's wrong on your end but when I access the url provided in my browser it works even with the example given previously. Try using some proxies, probably your IP has been temporary blocked somehow.

Yes, it might be something related to my local machine, because I've tried the same curl example in Google Colab and it worked. Nevertheless, I've also tried to obtain the same result with requests in Python but I coulnd't, so something might be not working properly in retrieving the data from signed_url using requests from examples/trending.py