coder-fly / douyin-signature Goto Github PK
View Code? Open in Web Editor NEWdouyin signature
douyin signature
不懂PY。我想请问一下在PHP网站里加载JS可以直接调用吗?我这边试了似乎不行。
Hi,
I just wonder how to generate the _Signature= of Comment endpoint Tiktok webAPI based.
they changed the algorithm recently.
I wish somebody can help to find out.
Thank you,
regards.
谢谢
一直超时
Hello thank you for your code, i have use your code and generated signature but when i download all videos of user that have 100 videos, i just get around 12-17 videos, could you please have me get the answer? Thank you so much
建议直接抓取原始码中整个 tac 值,以免之后又更新
pyppeteer.errors.ElementHandleError: Evaluation failed: TypeError: Cannot set property '0' of undefined
at c (http://127.0.0.1:5001/static/douyin.js:122:43)
at c (http://127.0.0.1:5001/static/douyin.js:130:75)
at r (http://127.0.0.1:5001/static/douyin.js:29:24)
at Object.e [as sign] (http://127.0.0.1:5001/static/douyin.js:201:44)
at generateSignature (http://127.0.0.1:5001/static/douyin.js:244:14)
运行程序出现这种错误,不知道怎么处理了
这个方法会导致一段时间以后Chrome.py进程自动挂掉
我尝试在centos、ubuntu和mac部署签名服务,但只有mac成功了,centos和ubutun都抛出同一段错误:
Traceback (most recent call last):
File "chrome.py", line 40, in <module>
loop.run_until_complete(connect_chrome(path))
File "/usr/lib64/python3.6/asyncio/base_events.py", line 484, in run_until_complete
return future.result()
File "chrome.py", line 20, in connect_chrome
browser = await launch(headless=False, args=["--no-sandbox", "--disable-gpu"], executablePath=path)
File "/usr/local/lib/python3.6/site-packages/pyppeteer/launcher.py", line 305, in launch
return await Launcher(options, **kwargs).launch()
File "/usr/local/lib/python3.6/site-packages/pyppeteer/launcher.py", line 166, in launch
self.browserWSEndpoint = get_ws_endpoint(self.url)
File "/usr/local/lib/python3.6/site-packages/pyppeteer/launcher.py", line 225, in get_ws_endpoint
raise BrowserError('Browser closed unexpectedly:\n')
pyppeteer.errors.BrowserError: Browser closed unexpectedly:
一开始我认为是chrome的问题,当我解决了chrome依赖问题和尝试多个chrome版本依然报错后,我直接用nmp安装了puppeteer,发现浏览器能够正常启动,所以现在更倾向认为是pyppeteer本身的问题,然而我并没有找到相关的解决方案,请问一下作者有遇到过这个问题吗?
另外我也想尝试通过node.js调用puppeteer,代码如下:
const puppeteer = require('puppeteer');
(async () => {
const webdriver_js = "() => Object.defineProperties(navigator,{webdriver:{get: () => false}})";
const browser = await puppeteer.launch({
headless: true,
args: ['--no-sandbox']
});
const page = await browser.newPage();
await page.setUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36");
await page.goto('http://127.0.0.1:8010/');
await page.evaluate(webdriver_js);
const sign = await page.evaluate('generateSignature', 'i)6a6i2spjks!i#tfus"0y\u02a1g,&qnfme', '86560737726');
console.log(sign);
await browser.close();
})();
但不管我向generateSignature传入或者不传入参数,使用node调用后打印的结果都是空字典
[root@iZwz998jigq7l0lwy0wmbyZ ~]# node sign.js
{}
response = requests.get('https://www.iesdouyin.com/share/user/58958068057', headers=headers, verify=False)
tac = re.search(r"tac='([\s\S]*?)'</script>", response.text)
此时的tac为None,不知是不是网页的加载方式有所改变?
谢了老哥,成功部署了
您好,你上传的douyin.js 是最先的吗?
我在本地分别用网页和node调用了js,得到的sign和服务器不一致,时候可以更新一下您服务器的js文件上来
调用参数
user_id: 58958068057
tac: i)69jnqjufcs!i#k5vs"0,<8~z
api返回结果 OBGmyBATZhOJTcwe.0zaYjgRpt
本地执行结果 OBGmyBATZhOx8J9SeqbaYjgRpt
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.