graphql查询语言:https://blog.csdn.net/qq_41882147/article/details/82966783

即:前端调用同一个接口传入不同的操作,得到不同的返回值

一直爬会封ip。

import requests, json, re, time

headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36",
"Cookie": "kuaishou.live.bfb1s=9b8f70844293bed778aade6e0a8f9942; clientid=3; did=web_a9d0c104cbfd24374a5dad685b26dd70; client_key=65890b29; didv=1594279985370; Hm_lvt_86a27b7db2c5c0ae37fee4a8a35033ee=1594622985; Hm_lpvt_86a27b7db2c5c0ae37fee4a8a35033ee=1594885138; userId=127345174; userId=127345174; kuaishou.live.web_st=ChRrdWFpc2hvdS5saXZlLndlYi5zdBKgAVwApsvd6d5LEq37Xwy4gVgfinmYKMKK5hT0t2Dl7nctTR46oTuc1Ku530mlTABB5PbNPqsDF4m5GjgTeFBbDgi4xBQ3cXCQHWfg-T7b9259MfvgaMoKB-r4R92eUR3VgXQz8bK7cJDrX_zKVEhh3WZscoFagE2xXXmFB9nXlmXMei2w5TAQih60pOlFpVMgqakLULnxvPY-BFIlNyoUlU8aEgCrAu8bFEUPixNgRvVq1Nb0ZSIglCraqHTuUQ_z3VWWktXq5nxr2SJYhM3aujbIbG9pAj0oBTAB; kuaishou.live.web_ph=3e0f6f0394323c61795f3382dabebad6f407"} def get_page1():
response = requests.get(url="https://live.kuaishou.com/profile/TXXW-666666", headers=headers)
res = response.text
# print(res)
video_page1 = re.findall('"id":"VideoFeed:(.*?)"',res)
print(video_page1) def get_video(resp):
eid = re.findall('"id":"(.*?)"',resp)
id = []
count = 0
while len(eid)>count: id.append(eid[count])
count=count+2 print(id)
return id def get_page(pcursor):
json0 = {
"operationName": "publicFeedsQuery",
"variables": {
"principalId": "TXXW-666666",
"pcursor": pcursor,
"count": 24
},
"query": "query publicFeedsQuery($principalId: String, $pcursor: String, $count: Int) { publicFeeds(principalId: $principalId, pcursor: $pcursor, count: $count) { pcursor live { user { id avatar name __typename } watchingCount poster coverUrl caption id playUrls { quality url __typename } quality gameInfo { category name pubgSurvival type kingHero __typename } hasRedPack liveGuess expTag __typename } list { id thumbnailUrl poster workType type useVideoPlayer imgUrls imgSizes magicFace musicName caption location liked onlyFollowerCanComment relativeHeight timestamp width height counts { displayView displayLike displayComment __typename } user { id eid name avatar __typename } expTag __typename } __typename }}"
} resp = requests.post(url="https://live.kuaishou.com/m_graphql",headers=headers,json=json0).text
resp_page = json.loads(resp)["data"]["publicFeeds"]["pcursor"]
# print(resp)
# li = json.loads(resp)["data"]["publicFeeds"]["list"]
# print(li) id = get_video(resp)
uri_list = video_address(id) video_detial(uri_list) return get_page(resp_page) def video_address(id):
url_list = []
for i in range(len(id)):
url_list.append("https://live.kuaishou.com/u/TXXW-666666/"+id[i]+"?did=web_a9d0c104cbfd24374a5dad685b26dd70") return url_list def video_detial(uri_list):
for i in range(len(uri_list)):
uri = uri_list[i] response = requests.get(url=uri,headers=headers).text
# time.sleep(0.5)
try:
# 标题
title = re.findall('"caption":"(.*?)"',response)[0]
# 播放量
playback = re.findall('"displayView":"(.*?)"',response)[0]
# 点赞数
playlike = re.findall('"displayLike":"(.*?)"',response)[0]
print(uri,title,playback,playlike)
except Exception as e:
print(uri,"暂无数据") if __name__ == '__main__':
# get_page("")
get_page1()

爬快手,graphql查询语言的更多相关文章

  1. Graphql介绍(Introduction to GraphQL)

    Introduction to GraphQL  GraphQL介绍 Learn about GraphQL, how it works, and how to use it in this seri ...

  2. GraphQL&DSL&API网关

    车联网服务non-RESTful架构改造实践   导读 在构建面向企业项目.多端的内容聚合类在线服务API设计的过程中,由于其定制特点,采用常规的restful开发模式,通常会导致大量雷同API重复开 ...

  3. REST 架构的替代方案 为什么说GraphQL是API的未来?

    Managing enterprise accounts - GitHub Docs https://docs.github.com/en/graphql/guides/managing-enterp ...

  4. Github上优秀的.NET Core项目

    Github上优秀的.NET Core开源项目的集合.内容包括:库.工具.框架.模板引擎.身份认证.数据库.ORM框架.图片处理.文本处理.机器学习.日志.代码分析.教程等. Github地址:htt ...

  5. 【转载】Github上优秀的.NET Core项目

    Github上优秀的.NET Core项目 Github上优秀的.NET Core开源项目的集合.内容包括:库.工具.框架.模板引擎.身份认证.数据库.ORM框架.图片处理.文本处理.机器学习.日志. ...

  6. Github上优秀的.NET Core开源项目的集合

    内容包括:库.工具.框架.模板引擎.身份认证.数据库.ORM框架.图片处理.文本处理.机器学习.日志.代码分析.教程等. Github地址:https://github.com/jasonhua95/ ...

  7. Facebook发布React 16 专利条款改为MIT开源协议

    9 月 26 日,用于构建 UI 的 JavaScript 库 React 16 的最新版本上线. Facebook 最终在现有的两种 React 版本中选择了出现 bug 概率最少的一款.这次版本更 ...

  8. 一系列令人敬畏的.NET核心库,工具,框架和软件

    内容 一般 框架,库和工具 API 应用框架 应用模板 身份验证和授权 Blockchain 博特 构建自动化 捆绑和缩小 高速缓存 CMS 代码分析和指标 压缩 编译器,管道工和语言 加密 数据库 ...

  9. F#周报2019年第27期

    新闻 介绍Femto--使用Fable绑定的自动化npm包解决方案 Babel 7.5.0发布,包含动态导入与F#管道 iOS 13预览版发布 视频及幻灯片 Fabulous--F#用于跨平台移动应用 ...

  10. 车联网服务non-RESTful架构改造实践

    导读 在构建面向企业项目.多端的内容聚合类在线服务API设计的过程中,由于其定制特点,采用常规的restful开发模式,通常会导致大量雷同API重复开发的窘境,本文介绍一种GraphQL查询语言+网关 ...

随机推荐

  1. Typora+PicGo+GitHub

    图片可以成功上传github,但是picgo相册无法预览,typora里也加载不出 image load failed 方法: 在`C:\Windows\System32\drivers\etc\ho ...

  2. Qt6以上安装速度慢解决-国内镜像加速

    1.安装抓包软件Fiddler最新版本 Fiddler30天试用 2.在软件下方输入栏内粘贴以下命令 urlreplace download.qt.io mirrors.tuna.tsinghua.e ...

  3. Mac10.13-10.15 下玩星际争霸1.16

    星际争霸DMG 存储在城通网盘,下载后挂载,复制到 应用程序 里就可以玩了 1, ctfile://xturlDG9QOlg_V29WOwI8UzEKZQdjUWEOOFJ7VCEHYFIxBzlTY ...

  4. ConcurrentHashMap在Java8中的变化

    增加红黑树这个存储结构 在Java8中,为什么要增加红黑树这种数据结构来进行存储,而不是全部使用链表来进行存储呢? 1.因为攻击者可以构造大量具有相同hashCode的内容,使其全部放在同一个列表中, ...

  5. python菜鸟学习: 1.用户登录输入输出

    # -*-coding: utf-8 -*-name = 'liyuzhoupan'password = '123'def login_test(): count = 0 while count &l ...

  6. ajax异步参数详解及alax错误信息error分析

    一.$.ajax()的参数列表 ↑ 下面是Jquery中AJAX参数详细列表: 参数名 类型 描述 url String (默认: 当前页地址) 发送请求的地址. type String (默认: & ...

  7. zk中控考勤机默认密码登陆

    网络空间搜索: app="ZKTECO-考勤管理系统" 找到某一个考勤系统 进行弱口令登陆:admin/****** 成功! End!!!

  8. Win10解决无法访问其他机器共享的问题【转】

    你不能访问此共享文件夹,因为你组织的安全策略阻止未经身份验证的来宾访问.这些策略可帮助保护你的电脑免受网络上不安全设备或恶意设备的威胁.管理员身份执行sc.exe config lanmanworks ...

  9. vue中关于get传参数为数组的解决方法

    按理来说,get请求方式是没有数组的,get请求方式带参数都是字符串,需要和后端协商是用某个标识符分割开,例如"|"   ",". 当然如果需要数组的话,也能解 ...

  10. c++项目

    如题, 想搞1-2个c++项目把目前除了进程.线程管理的所有所学都用起来. 在自己设想中.