<em>Mac</em>Book项目 2009年学校开始实施<em>Mac</em>Book项目,所有师生配备一本<em>Mac</em>Book,并同步更新了校园无线网络。学校每周进行电脑技术更新,每月发送技术支持资料,极大改变了教学及学习方式。因此2011
2021-06-01 09:32:01
今天的這個指令碼,是一個別人發的外包,互動介面的程式碼就不在這裡說了,但是可以分享下自動評論、自動點贊、自動關注、採集評論和視訊的資料是如何實現的
python 3.8 執行程式碼
pycharm 2021.2 輔助敲程式碼
requests 第三方模組
模擬使用者端,向伺服器傳送請求
def __init__(self): self.headers = { 'content-type': 'application/json', 'Cookie': 'kpf=PC_WEB; kpn=KUAISHOU_VISION; clientid=3; did=web_ea128125517a46bd491ae9ccb255e242; client_key=65890b29; didv=1646739254078; _bl_uid=pCldq3L00L61qCzj6fytnk2wmhz5; userId=270932146; kuaishou.server.web_st=ChZrdWFpc2hvdS5zZXJ2ZXIud2ViLnN0EqABH2BHihXp4liEYWMBFv9aguyfs8BsbINQIWqgoDw0SimMkpXwM7PKpKdJcZbU12QOyeKFaG4unV5EUkkEswL0HnA8_A9z2ujLlKN__gRsxU2B5kIYgirTDPiVJ3uPN1sU9mqvog3auoNJxDdbKjVeFNK1wQ5HTM_yUvYvmWOx9iC8IKcvnmo9YnG_J9ske-t-wiCWMgSCA25HN6MRqCMxuhoSnIqSq99L0mk4jolsseGdcwiNIiC8rjheuewIA1Bk3LwkNIYikU2zobcuvgAiBbMnBuDixygFMAE; kuaishou.server.web_ph=55c7e6b2033ea94a3447ea98082642cd6f1a', 'Host': 'www.ks.com', 'Origin': 'https://www.ks.com', 'Referer': 'https://www.ks.com/search/video?searchKey=%E9%BB%91%E4%B8%9D', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36', } self.url = 'https://www.ks.com/graphql'
def get_search(self, keyword, pcursor): """ :param keyword: 關鍵詞 :param pcursor: 頁碼 :return: 搜尋作品 """ json = { 'operationName': "visionSearchPhoto", 'query': "fragment photoContent on PhotoEntity {n idn durationn captionn likeCountn viewCountn realLikeCountn coverUrln photoUrln photoH265Urln manifestn manifestH265n videoResourcen coverUrls {n urln __typenamen }n timestamp n animatedCoverUrln distancen videoRation likedn stereoTypen profileUserTopPhoton __typenamen}nnfragment feedContent on Feed {n typen author {n idn namen headerUrln followingn headerUrls {n urln __typenamen }n __typenamen }n photo {n ...photoContentn __typenamen }n canAddCommentn llsidn statusn currentPcursorn __typenamen}nnquery visionSearchPhoto($keyword: String, $pcursor: String, $searchSessionId: String, $page: String, $webPageArea: String) {n visionSearchPhoto(keyword: $keyword, pcursor: $pcursor, searchSessionId: $searchSessionId, page: $page, webPageArea: $webPageArea) {n resultn llsidn webPageArean feeds {n ...feedContentn __typenamen }n searchSessionIdn pcursorn aladdinBanner {n imgUrln linkn __typenamen }n __typenamen }n}n", 'variables': {'keyword': keyword, 'pcursor': pcursor, 'page': "search"} } response = requests.post(url=self.url, json=json, headers=self.headers) json_data = response.json() print(json_data) return json_data
def get_comments(self, photoId, pcursor): """ :param photoId: 作品id :param pcursor: 頁碼 :return: 評論內容 """ json = { 'operationName': "commentListQuery", 'query': "query commentListQuery($photoId: String, $pcursor: String) { visionCommentList(photoId: $photoId, pcursor: $pcursor) {n commentCountn rootComments {n commentIdn authorIdn authorNamen contentn headurln timestampn likedCountn realLikedCountn likedn statusn subCommentCountn subCommentsPcursorn subComments {n commentIdn authorIdn authorNamen contentn headurln timestampn likedCountn realLikedCountn likedn statusn replyToUserNamen replyTon __typenamen }n __typenamen }n __typenamen }n}n", 'variables': {'photoId': photoId, 'pcursor': pcursor} } response = requests.post(url=self.url, json=json, headers=self.headers) json_data = response.json() print(json_data) return json_data
def post_comment(self, content, photoAuthorId, photoId): """ :param content: 評論內容 :param photoAuthorId: 該作品的作者id :param photoId: 作品id :return: 有沒有成功 """ json = { 'operationName': "visionAddComment", 'query': "mutation visionAddComment($photoId: String, $photoAuthorId: String, $content: String, $replyToCommentId: ID, $replyTo: ID, $expTag: String) { (photoId: $photoId, photoAuthorId: $photoAuthorId, content: $content, replyToCommentId: $replyToCommentId, replyTo: $replyTo, expTag: $expTag) {n resultn commentIdn contentn timestampn statusn __typenamen }n}n", 'variables': { 'content': content, 'expTag': "1_a/2005158523885162817_xpcwebsearchxxnull0", 'photoAuthorId': photoAuthorId, 'photoId': photoId } } response = requests.post(url=self.url, json=json, headers=self.headers) json_data = response.json() print(json_data) return json_data
def is_like(self, photoId, photoAuthorId): """ :param photoId: 作品id :param photoAuthorId: 該作品的作者id :return: 有沒有成功 """ 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 resultn __typenamen }n}", 'variables': { 'cancel': 0, 'expTag': "1_a/2005158523885162817_xpcwebsearchxxnull0", 'photoAuthorId': photoAuthorId, 'photoId': photoId } } response = requests.post(url=self.url, json=json, headers=self.headers) json_data = response.json() print(json_data) return json_data
def is_follow(self, touid): """ :param touid: 使用者id :return: """ json = { 'operationName': "visionFollow", 'query': "mutation visionFollow($touid: String, $ftype: Int, $followSource: Int, $expTag: String) {n visionFollow(touid: $touid, ftype: $ftype, followSource: $followSource, expTag: $expTag) {n followStatusn hostNamen error_msgn __typenamen }n}n", 'variables': { 'expTag': "1_a/2005158523885162817_xpcwebsearchxxnull0", 'followSource': 3, 'ftype': 1, 'touid': touid } } response = requests.post(url=self.url, json=json, headers=self.headers) json_data = response.json() print(json_data) return json_data
def get_userInfo(self, userId): """ :param userId: 使用者ID :return: 使用者資訊 """ json = { 'operationName': "visionProfile", 'query': "query visionProfile($userId: String) {n visionProfile(userId: $userId) {n hostNamen userProfile {n ownerCount {n fann photon follown photo_publicn __typenamen }n profile {n gendern user_namen user_idn headurln user_textn user_profile_bg_urln __typenamen }n isFollowingn __typenamen }n __typenamen }n}n", 'variables': {'userId': userId} } response = requests.post(url=self.url, json=json, headers=self.headers) json_data = response.json() print(json_data) return json_data
def get_video(self, userId, pcursor): """ :param userId: 使用者id :param pcursor: 頁碼 :return: 作品 """ json = { 'operationName': "visionProfilePhotoList", 'query': "fragment photoContent on PhotoEntity {n durationn captionn likeCountn viewCountn realLikeCountn coverUrln photoUrln photoH265Urln manifestn manifestH265n videoResourcen coverUrls {n urln __typenamen }n timestampn expTagn animatedCoverUrln distancen videoRation likedn stereoTypen profileUserTopPhoton __typenamen}nnfragment feedContent on Feed {n typen author {n idn namen headerUrln followingn headerUrls {n urln __typenamen }n __typenamen }n photo {n ...photoContentn __typenamen }n canAddCommentn llsidn statusn currentPcursorn __typenamen}nnquery visionProfilePhotoList($pcursor: String, $userId: String, $page: String, $webPageArea: String) {n visionProfilePhotoList(pcursor: $pcursor, userId: $userId, page: $page, webPageArea: $webPageArea) {n resultn llsidn webPageArean feeds {n ...feedContentn __typenamen }n hostNamen pcursorn __typenamen }n}n", 'variables': {'userId': userId, 'pcursor': pcursor, 'page': "profile"} } response = requests.post(url=self.url, json=json, headers=self.headers) json_data = response.json() print(json_data) return json_data
if __name__ == '__main__': kuaishou = KuaiShou() # 獲取評論 kuaishou.get_comments('3xzry7secwhunai', '') # 釋出評論 kuaishou.post_comment('愛你', '3xgz9zaku7hig96', '3xydesqbvtrvcuq') # 點贊 kuaishou.is_like('3xydesqbvtrvcuq', '3xgz9zaku7hig96') # 關注 kuaishou.is_follow('3xxhfqquuachnje') # 創作者資訊 kuaishou.get_userInfo('3xxhfqquuachnje') # 獲取創作者作品 kuaishou.get_video('3xxhfqquuachnje', '')
以上就是Python實現簡單自動評論自動點贊自動關注指令碼的詳細內容,更多關於Python自動評論點贊關注指令碼的資料請關注it145.com其它相關文章!
相關文章
<em>Mac</em>Book项目 2009年学校开始实施<em>Mac</em>Book项目,所有师生配备一本<em>Mac</em>Book,并同步更新了校园无线网络。学校每周进行电脑技术更新,每月发送技术支持资料,极大改变了教学及学习方式。因此2011
2021-06-01 09:32:01
综合看Anker超能充系列的性价比很高,并且与不仅和iPhone12/苹果<em>Mac</em>Book很配,而且适合多设备充电需求的日常使用或差旅场景,不管是安卓还是Switch同样也能用得上它,希望这次分享能给准备购入充电器的小伙伴们有所
2021-06-01 09:31:42
除了L4WUDU与吴亦凡已经多次共事,成为了明面上的厂牌成员,吴亦凡还曾带领20XXCLUB全队参加2020年的一场音乐节,这也是20XXCLUB首次全员合照,王嗣尧Turbo、陈彦希Regi、<em>Mac</em> Ova Seas、林渝植等人全部出场。然而让
2021-06-01 09:31:34
目前应用IPFS的机构:1 谷歌<em>浏览器</em>支持IPFS分布式协议 2 万维网 (历史档案博物馆)数据库 3 火狐<em>浏览器</em>支持 IPFS分布式协议 4 EOS 等数字货币数据存储 5 美国国会图书馆,历史资料永久保存在 IPFS 6 加
2021-06-01 09:31:24
开拓者的车机是兼容苹果和<em>安卓</em>,虽然我不怎么用,但确实兼顾了我家人的很多需求:副驾的门板还配有解锁开关,有的时候老婆开车,下车的时候偶尔会忘记解锁,我在副驾驶可以自己开门:第二排设计很好,不仅配置了一个很大的
2021-06-01 09:30:48
不仅是<em>安卓</em>手机,苹果手机的降价力度也是前所未有了,iPhone12也“跳水价”了,发布价是6799元,如今已经跌至5308元,降价幅度超过1400元,最新定价确认了。iPhone12是苹果首款5G手机,同时也是全球首款5nm芯片的智能机,它
2021-06-01 09:30:45