Coder Social home page Coder Social logo

Replace Tac Token about tiktok-signature HOT 9 CLOSED

carcabot avatar carcabot commented on July 17, 2024
Replace Tac Token

from tiktok-signature.

Comments (9)

carcabot avatar carcabot commented on July 17, 2024

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.

Lem0nTree avatar Lem0nTree commented on July 17, 2024

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.

carcabot avatar carcabot commented on July 17, 2024

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.

tindt94 avatar tindt94 commented on July 17, 2024

@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.

raeyulca avatar raeyulca commented on July 17, 2024

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.

raeyulca avatar raeyulca commented on July 17, 2024

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.

zmeeust avatar zmeeust commented on July 17, 2024

@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.

rinxor avatar rinxor commented on July 17, 2024

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.

carcabot avatar carcabot commented on July 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.