Comments (9)
Hi,
Just browse to trending page and search for <script>tac='
you have to copy this token over this one.
But, I'm not sure if this is your problem. Make sure that you generate signature for the right link
Greetings.
from tiktok-signature.
Hi, thank you for the quick reply :)
I noticed that if i create the signature for the comment service url, it works
signature generator
node signature.js 'https://www.tiktok.com/share/item/comment/list?id=6763586087693618434&count=48&cursor=0'
testing
import requests
signature = "VIm6dAAgEBardkWLNbAE1FSJDWAAAlc"
referer = "https://www.tiktok.com/@179ling/video/6763586087693618434"
url = "https://www.tiktok.com/share/item/comment/list?id=6763586087693618434&count=48&cursor=0" + \
"&_signature=" + signature # same service url
request = requests.get(url, headers={"method": "GET",
"accept-encoding": "gzip, deflate, br",
"Referer": 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 = request.json()
print(data)
But if i create signature for other services like the explore feed, it doesn't work :s
signature generation
node signature.js 'https://www.tiktok.com/share/item/explore/list'
testing
import requests
signature = "VIm6dAAgEBardkWLNbD051SJDWAAAlc"
referer = "https://www.tiktok.com/@179ling/video/6763586087693618434"
url = "https://www.tiktok.com/share/item/explore/list" + \
"&_signature=" + signature # same service url
request = requests.get(url, headers={"method": "GET",
"accept-encoding": "gzip, deflate, br",
"Referer": 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 = request.json()
print(data)
error
File ".\test.py", line 13, in <module>
data = request.json()
File "C:\Users\loren\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Users\loren\AppData\Local\Programs\Python\Python37\lib\json\__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "C:\Users\loren\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\loren\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
from tiktok-signature.
I'm not sure if that service url that you've tried require signature. I have opened it without one and got status=0 which means that It doesn't require one.
from tiktok-signature.
@carcabot
I have the same issue too even I try to replace tac with the newest one from the trending page.
Can you help us to check it again? Many thanks.
from tiktok-signature.
Hello.
The issue that you are having is that the code will not execute properly in any sort of "automated" browser.
I haven't been able to pinpoint exactly what the issue is because deobfuscating code isn't my forte, however I've tested and found that running the code both via selenium and via this solution will produce incorrect results.
If I had to guess, the obfuscated code is examining window flags/names and returning an answer that the tiktok servers can verify as "wrong".
from tiktok-signature.
Hello again.
I have been able to fix the issue. Selenium et. al. set this.navigator.webdriver
to true
.
Setting it back to return undefined
will allow the signature to work again. It caused only a one character difference, but that was enough for the server to reject signatures.
from tiktok-signature.
@raeyulca
Hello.
You did something else besides hiding webdriver? I changed it to "undefined" but signature is wrong. Maybe TikTok check something else?
from tiktok-signature.
The obfuscated code in the tac checks many vars. Some of the vars it checks are process,__webdriver_evaluate,__selenium_evaluate,__webdriver_script_function,__webdriver_script_func,__webdriver_script_fn,__fxdriver_evaluate,__driver_unwrapped,__webdriver_unwrapped,__driver_evaluate,__selenium_unwrapped,__fxdriver_unwrapped,_selenium,callSelenium,_Selenium_IDE_Recorder. I would not load a new tac since the one included in the js file works and a new tac value could add even more checks.
Your signature may be failing because you are running it in an environment other than node or you are not passing some required value such as the referrer. Compare your request to the one in trending.py
from tiktok-signature.
You don't have to do any other changes to the library to work. tac
token is not necessary to be updated for every request.
You should pay more attention to trending.py file, all headers must be there, the signature is based on url arguments, you should include use quotation mark when generating signature
node signature.js "https://www.tiktok.com/share/item/list?argument1=test&argument2=test"
The library is still working.
from tiktok-signature.
Related Issues (20)
- How to get msToken HOT 3
- page.addScriptTag: Refused to execute inline script because it violates the following Content Security Policy directive: "script-src... HOT 1
- Retrieving `secUid`? HOT 3
- Cannot run with Docker on Linux + is it possible to dynamically get hardcoded values? HOT 6
- `user-info.js` example times out HOT 2
- Trending example returns list of users instead of list of videos HOT 2
- trending.py returns empty response HOT 2
- Pulling data for all user videos? HOT 2
- Normal search example HOT 1
- How to sign a hashtag request? HOT 1
- python support HOT 4
- How do you get the downloadAddress to work? HOT 1
- X-bogus on video list api
- User-videos request is returning empty data
- URL length issue reported, localhost: 8080/signature
- Hashtag is only getting 30 results
- how to setup in vercel
- Fetch user info returns empty info HOT 2
- Fetching user videos not working on deployment HOT 4
- Frequent Empty String Returns in examples/user-video.js HOT 19
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tiktok-signature.