b1gm8c / x-bogus Goto Github PK
View Code? Open in Web Editor NEW抖音X-Bogus生成接口
抖音X-Bogus生成接口
请问怎么会有这个报错的啊,安装nodejs环境了
想联系作者进一步学习研究这个,请问如何联系呢
有个链接的签名,之前是可以用的,最近都失效了
不确定是不是douyin升级了
我想知道这个xb的js是怎么获取到的?
执行测试用例时报错
execjs._exceptions.ProgramError: SyntaxError: 缺少 ';'
没有更详细的提示,不知该如何解决
如何本地部署X-Bogus 、基于宝塔
例子好像是get接口, 是否可以支持post的带form的接口呢 例如关注之类的
`#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import requests,random,urllib.parse
def get_ttwid():
"""
ttwid生成
"""
data = {"region":"cn","aid":6383,"needFid":False,"service":"www.ixigua.com","migrate_info":{"ticket":"","source":"node"},"cbUrlProtocol":"https","union":True}
headers = {
'User-Agent': 'Mozilla/5.0 (Linux; Android 10; Redmi K30 Pro) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Mobile Safari/537.36',
}
url = "https://ttwid.bytedance.com/ttwid/union/register/"
res = requests.post(url, json=data)
#获取headers中的ttwid
cookie = res.headers['Set-Cookie']
# print(cookie)
ttwid = cookie.split(' ')[0]
# print(ttwid)
#去掉ttwid=,ttwid后面的分号
ttwid = ttwid.replace("ttwid=","").replace(";","")
return ttwid
def generate_random_str(randomlength=107):
"""
根据传入长度产生随机字符串
:param randomlength: 随机字符串长度
"""
random_str = ''
base_str = 'ABCDEFGHIGKLMNOPQRSTUVWXYZabcdefghigklmnopqrstuvwxyz0123456789='
length = len(base_str) - 1
for _ in range(randomlength):
random_str += base_str[random.randint(0, length)]
return random_str
def get_x_bogus(url):
"""
X-Bogus生成
param url: 参数中的url
"""
data = {
"url":url,
"user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"
}
# postUrl = "http://127.0.0.1:8787/X-Bogus"
postUrl = "https://tiktok.iculture.cc/X-Bogus"
res = requests.post(postUrl, json=data)
return res.json()
def main():
odin_tt="324fb4ea4a89c0c05827e18a1ed9cf9bf8a17f7705fcc793fec935b637867e2a5a9b8168c885554d029919117a18ba69"
ttwid = get_ttwid()
msToken = generate_random_str()
bd_ticket_guard_client_data="eyJiZC10aWNrZXQtZ3VhcmQtdmVyc2lvbiI6MiwiYmQtdGlja2V0LWd1YXJkLWNsaWVudC1jc3IiOiItLS0tLUJFR0lOIENFUlRJRklDQVRFIFJFUVVFU1QtLS0tLVxyXG5NSUlCRFRDQnRRSUJBREFuTVFzd0NRWURWUVFHRXdKRFRqRVlNQllHQTFVRUF3d1BZbVJmZEdsamEyVjBYMmQxXHJcbllYSmtNRmt3RXdZSEtvWkl6ajBDQVFZSUtvWkl6ajBEQVFjRFFnQUVKUDZzbjNLRlFBNUROSEcyK2F4bXAwNG5cclxud1hBSTZDU1IyZW1sVUE5QTZ4aGQzbVlPUlI4NVRLZ2tXd1FJSmp3Nyszdnc0Z2NNRG5iOTRoS3MvSjFJc3FBc1xyXG5NQ29HQ1NxR1NJYjNEUUVKRGpFZE1Cc3dHUVlEVlIwUkJCSXdFSUlPZDNkM0xtUnZkWGxwYmk1amIyMHdDZ1lJXHJcbktvWkl6ajBFQXdJRFJ3QXdSQUlnVmJkWTI0c0RYS0c0S2h3WlBmOHpxVDRBU0ROamNUb2FFRi9MQnd2QS8xSUNcclxuSURiVmZCUk1PQVB5cWJkcytld1QwSDZqdDg1czZZTVNVZEo5Z2dmOWlmeTBcclxuLS0tLS1FTkQgQ0VSVElGSUNBVEUgUkVRVUVTVC0tLS0tXHJcbiJ9"
url = "https://www.douyin.com/aweme/v1/web/general/search/single/?device_platform=webapp&aid=6383&channel=channel_pc_web&search_channel=aweme_general&sort_type=0&publish_time=0&keyword=seo&search_source=normal_search&query_correct_type=1&is_filter_search=0&from_group_id=&offset=0&count=10&pc_client_type=1&version_code=190600&version_name=19.6.0&cookie_enabled=true&screen_width=1920&screen_height=1080&browser_language=zh-CN&browser_platform=Win32&browser_name=Chrome&browser_version=113.0.0.0&browser_online=true&engine_name=Blink&engine_version=113.0.0.0&os_name=Windows&os_version=10&cpu_core_num=12&device_memory=8&platform=PC&downlink=10&effective_type=4g&round_trip_time=50&webid=7233971287974151739"
#msToken
url = url+"&msToken="+msToken
res = get_x_bogus(url)
url = res['param']
xBogus = res['X-Bogus']
# #url 后面加msToken
print(url, xBogus)
headers = {
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"Referer":"https://www.douyin.com/",
"Cookie":f"msToken={msToken};odin_tt={odin_tt};ttwid={ttwid};bd_ticket_guard_client_data={bd_ticket_guard_client_data}",
}
print(headers)
# #请求抖音接口
res = requests.get(url, headers=headers)
print("结果",res.text)
if __name__ == '__main__':
main()`
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.