脚本之家,脚本语言编程技术及教程分享平台!
分类导航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|

服务器之家 - 脚本之家 - Python - Python获取抖音关注列表封号账号的实现代码

Python获取抖音关注列表封号账号的实现代码

2021-11-30 10:06海不眠 Python

最近抖音关注到达上限5000个了,所以就导致很多漂亮小姐姐没办法关注了,那么这里就通过python获取已经被封号的帐号取消关注就可以了

最近抖音关注到达上限5000个了,所以就导致很多漂亮小姐姐没办法关注了,那么这里就通过python获取已经被封号的帐号取消关注就可以了

实现代码

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import requests
import json
import time
 
# 抖音创作者平台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开始检测,请耐心等待...")
while (sl < 5000):
    url = 'https://creator.douyin.com/aweme/v1/creator/relation/following/list/?aid=2906&app_name=aweme_creator_platform&device_platform=web&referer=https:%2F%2Fcreator.douyin.com%2Fcreator-micro%2Fhome&user_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.36&cookie_enabled=true&screen_width=1536&screen_height=864&browser_language=zh-CN&browser_platform=Win32&browser_name=Mozilla&browser_version=5.0+(Windows+NT+10.0%3B+Win64%3B+x64)+AppleWebKit%2F537.36+(KHTML,+like+Gecko)+Chrome%2F90.0.4430.212+Safari%2F537.36&browser_online=true&timezone_name=Asia%2FShanghai&_signature=_02B4Z6wo00901TSjMlwAAIDChFLelrWwFwk0pzbAAC2OgYeyEeDw.eiDhwpfH.4NSilIGJd.pSZ5de4SL4e-U2DQy-VLvH0NkfwTIp14WBZCgv63l6pLIkqBZMs9VRrdqIj3xOjfyY.2y6v8de&cursor='+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("检测完成,已检测账号"+str(sl)+"个,异常账号共计"+str(yczh)+"个")
            print("异常账号存储在: "+file.name)
            file.close()
            exit()
    else:
        if ("status_message" in json_str):
            print(json_str['status_message']+",已检测账号"+str(sl)+"个")
            print("等待3分钟继续执行")
            time.sleep(180)
            print("继续执行")
        else:
            print(json_str)
            print(sbdy)
            yn = input("是否重试,继续执行?[y/n]")
            if (yn == "n"):
                file.close()
                exit()

需要手动去抖音创作者平台获取cookie,注意,只是封了头像的用户也会获取的,因为原理就是判断头像地址
我是新手,学Python写的,能用就行:loveliness:

原文链接:https://www.52pojie.cn/thread-1445492-1-1.html

延伸 · 阅读

精彩推荐