抖音 用戶id轉(zhuǎn)uid
本文所有教程及源碼、軟件僅為技術(shù)研究。不涉及計(jì)算機(jī)信息系統(tǒng)功能的刪除、修改、增加、干擾,更不會(huì)影響計(jì)算機(jī)信息系統(tǒng)的正常運(yùn)行。不得將代碼用于非法用途,如侵立刪!
用戶id轉(zhuǎn)uid
環(huán)境
win10
Python3.9
PyQt5
效果

抖音id轉(zhuǎn)sec_uid
def get_sec_uid(self, un_id):
? ?headers = {
? ? ? ?"Accept": "application/json, text/plain, */*",
? ? ? ?"Referer": "https://www.douyin.com/",
? ? ? ?"Accept-Language": "zh-CN,zh;q=0.9",
? ? ? ?"Proxy-Tunnel": str(random.randint(1, 10000)) ?# 設(shè)置IP切換頭
? ?}
? ?response = requests.get(url, headers=headers)
? ?print(response.text)
? ?user_info = response.json()
? ?if not user_info:
? ? ? ?return None
? ?sec_uid = user_info.get("sec_uid")
? ?nickname = user_info.get("nickname")
? ?return sec_uid, nickname
sec_uid轉(zhuǎn)uid
def get_uid(self, sec_uid):
? ?headers = {
? ? ? ? ? ?"Host": "imdesktop.douyin.com",
? ? ? ? ? ?"Accept-Language": "zh-CN",
? ? ? ? ? ?"Sec-Fetch-Dest": "empty",
? ? ? ? ? ?"Sec-Fetch-Mode": "cors",
? ? ? ? ? ?"Sec-Fetch-Site": "cross-site",
? ? ? ? ? ?"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) ????/1.0.6 Chrome/104.0.5112.102 Electron/20.1.0-tt.4.release.main.4 TTElectron/20.1.0-tt.4.release.main.4 Safari/537.36",
? ? ? ? ? ?"accept": "application/json, text/plain, */*",
? ? ? ? ? ?"bd-ticket-guard-version": "1",
? ? ? ? ? ?"referer": "https://imdesktop.douyin.com",
? ? ? ? ? ?"sdk-version": "2",
? ? ? ? ? ?"sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"104\"",
? ? ? ? ? ?"sec-ch-ua-mobile": "?0",
? ? ? ? ? ?"sec-ch-ua-platform": "\"Windows\"",
? ? ? ? ? ?"x-tt-disable-sessionid": "1",
? ? ? ?}
? ?response = requests.get(url, headers=headers)
? ?print(response.text)
? ?user_info = response.json()
? ?if not user_info:
? ? ? ?return None
? ?uid= user_info.get("uid")
? ?return uid
資源下載
本文僅供學(xué)習(xí)交流使用,如侵立刪!