最近抖音關(guān)注到達(dá)上限5000個(gè)了,所以就導(dǎo)致很多漂亮小姐姐沒辦法關(guān)注了,那么這里就通過python獲取已經(jīng)被封號(hào)的帳號(hào)取消關(guān)注就可以了
import requests
import json
import time
# 抖音創(chuàng)作者平臺(tái)cookie
header = {'Cookie': '你的COOKIE'}
shijian = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
sbdy = str(0)
sl = 0
file = open("D:/test.txt", "a+",encoding='utf-8')
file.write(shijian)
yczh = 0
print(str(shijian)+"\n開始檢測(cè),請(qǐng)耐心等待...")
while (sl 5000):
url = 'https://creator.douyin.com/aweme/v1/creator/relation/following/list/?aid=2906app_name=aweme_creator_platformdevice_platform=webreferer=https:%2F%2Fcreator.douyin.com%2Fcreator-micro%2Fhomeuser_agent=Mozilla%2F5.0+(Windows+NT+10.0%3B+Win64%3B+x64)+AppleWebKit%2F537.36+(KHTML,+like+Gecko)+Chrome%2F90.0.4430.212+Safari%2F537.36cookie_enabled=truescreen_width=1536screen_height=864browser_language=zh-CNbrowser_platform=Win32browser_name=Mozillabrowser_version=5.0+(Windows+NT+10.0%3B+Win64%3B+x64)+AppleWebKit%2F537.36+(KHTML,+like+Gecko)+Chrome%2F90.0.4430.212+Safari%2F537.36browser_online=truetimezone_name=Asia%2FShanghai_signature=_02B4Z6wo00901TSjMlwAAIDChFLelrWwFwk0pzbAAC2OgYeyEeDw.eiDhwpfH.4NSilIGJd.pSZ5de4SL4e-U2DQy-VLvH0NkfwTIp14WBZCgv63l6pLIkqBZMs9VRrdqIj3xOjfyY.2y6v8decursor='+sbdy+'count=20'
r = requests.get(url,headers=header)
json_str = json.loads(r.text)
if (int(json_str['status_code']) == int('0')):
if ("user_info_list" in json_str):
av = json_str['user_info_list']
for d in av:
url = str(d['avatar'])
if (url == "c16000003f97583dac4" or url == "b76600039bd12b4c09da"):
print("用戶名:"+d['nickname']+" 不正常")
text = str('\n'+d['nickname'])
file.write(text)
sl+=1
yczh+=1
else:
# print("用戶名:"+d['nickname']+" 正常")
sl+=1
sbdy = str(json_str['cursor'])
else:
print("檢測(cè)完成,已檢測(cè)賬號(hào)"+str(sl)+"個(gè),異常賬號(hào)共計(jì)"+str(yczh)+"個(gè)")
print("異常賬號(hào)存儲(chǔ)在: "+file.name)
file.close()
exit()
else:
if ("status_message" in json_str):
print(json_str['status_message']+",已檢測(cè)賬號(hào)"+str(sl)+"個(gè)")
print("等待3分鐘繼續(xù)執(zhí)行")
time.sleep(180)
print("繼續(xù)執(zhí)行")
else:
print(json_str)
print(sbdy)
yn = input("是否重試,繼續(xù)執(zhí)行?[y/n]")
if (yn == "n"):
file.close()
exit()