吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2278|回复: 5
收起左侧

[Python 转载] 快手获取关注列表,搭配爬取视频。效果更好

[复制链接]
TZ糖纸 发表于 2021-4-19 13:19
本帖最后由 TZ糖纸 于 2021-4-22 19:44 编辑

[Python] 纯文本查看 复制代码
import json

import re

import os

import requests

import urllib.request

import KuaiShou2



requestUrl = 'https://video.kuaishou.com/graphql'



Cookie = ''



def post(pcursor):

    data = {"operationName":"visionProfileUserList","variables":{"ftype":1,"pcursor":pcursor},"query":"query visionProfileUserList($pcursor: String, $ftype: Int) {\n  visionProfileUserList(pcursor: $pcursor, ftype: $ftype) {\n    result\n    fols {\n      user_name\n      headurl\n      user_text\n      isFollowing\n      user_id\n      __typename\n    }\n    hostName\n    pcursor\n    __typename\n  }\n}\n"}

    failed = {'msg': 'failed...'}

    headers = {

        'Host':'video.kuaishou.com',

        'Connection':'keep-alive',

        'Content-Length':'1261',

        'accept':'*/*',

        'User-Agent':'Mozilla/5.0(WindowsNT10.0;Win64;x64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/89.0.4389.114Safari/537.36Edg/89.0.774.68',

        'content-type':'application/json',

        'Origin':'https://video.kuaishou.com',

        'Sec-Fetch-Site':'same-origin',

        'Sec-Fetch-Mode':'cors',

        'Sec-Fetch-Dest':'empty',

        'Accept-Language':'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',

        'Cookie':Cookie,



    }

    r = requests.post(requestUrl, data=json.dumps(data), headers=headers)  

    r.encoding = 'UTF-8'

    html = r.text

    return html



if __name__ == "__main__":

    userList = []

    for i in range(1,10):

        result = post(i * 30)

        data = json.loads(result)

        fols = data['data']['visionProfileUserList']['fols']

        for user in fols:

            userList.append(user['user_id'])



    KuaiShou2.Start(userList)









KuaiShou2在上篇帖子有
传送门:https://www.52pojie.cn/thread-1414901-1-1.html

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

啦啦啦啦嘿 发表于 2021-4-19 13:37
刚好再找这个,谢谢楼主
特百惠 发表于 2021-4-19 14:40
 楼主| TZ糖纸 发表于 2021-4-19 16:08
 楼主| TZ糖纸 发表于 2021-4-22 19:43
权源夏宇 发表于 2021-4-22 23:51
这样子了怎么办啊
QQ截图20210422235104.png
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-3-29 13:23

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表