python爬虫--快手完整功能版
点赞,评论,下载,批量下载,关注,作者信息
公众号回复 快手完整版 获取源代码
我们进行点赞和关注查看一下调用的文件
发现都是一个文件,只是负载参数不同
查看请求url、请求方法、请求标头、负载参数
点赞
def DZ(self,photoAuthorId,photoId):
# photoAuthorId : 作者ID # photoId : 作品ID
json = {'operationName': "visionVideoLike", 'query': "mutation visionVideoLike($photoId: String, $photoAuthorId: String, $cancel: Int, $expTag: String) {\n visionVideoLike(photoId: $photoId, photoAuthorId: $photoAuthorId, cancel: $cancel, expTag: $expTag) {\n result\n __typename\n }\n}\n", 'variables': {'cancel': 0,'expTag': "1_a/2005456839189488401_xpcwebsearchxxnull0",'photoAuthorId': photoAuthorId,'photoId': photoId}} r = requests.post(url=self.url, json=json, headers=self.header) print(r.text
关注
def GZ(self,photoAuthorId):'operationName': "visionFollow", 'query': "mutation visionFollow($touid: String, $ftype: Int, $followSource: Int, $expTag: String) {\n visionFollow(touid: $touid, ftype: $ftype, followSource: $followSource, expTag: $expTag) {\n result\n followStatus\n hostName\n error_msg\n __typename\n }\n}\n", 'variables': {'expTag': "1_a/2001656225609422690_xpcwebsearchxxnull0",'followSource': 3,'ftype': 1,'touid': photoAuthorId}} r = requests.post(url=self.url, json=json, headers=self.header) print(r.json())
评论
def PL(self,photoAuthorId,photoId,content):
# photoAuthorId : 作者ID # photoId : 作品ID # content : 评论内容 json = {'operationName': "visionAddComment", 'query': "mutation visionAddComment($photoId: String, $photoAuthorId: String, $content: String, $replyToCommentId: ID, $replyTo: ID, $expTag: String) {\n visionAddComment(photoId: $photoId, photoAuthorId: $photoAuthorId, content: $content, replyToCommentId: $replyToCommentId, replyTo: $replyTo, expTag: $expTag) {\n result\n commentId\n content\n timestamp\n status\n __typename\n }\n}\n", 'variables': {'content': content,'expTag': "1_a/2005483920595723409_xpcwebsearchxxnull0",'photoAuthorId': photoAuthorId,'photoId': photoId}} r = requests.post(url=self.url, json=json, headers=self.header) print(r.json())
这些是点赞,评论,关注功能
还有批量下载视频和作者信息作者作品功能
请关注公众号回复 快手完整版 获取完整功能源代码
欢迎分享文章
代码仅供学习参考
感谢观看!