本章测试一个作品的评论及翻页:
以及前面的抓x包方式,在专栏里也有很多,xposed抓包过sslping,通用版本等;
https://codeooo.blog.csdn.net/category_11500477.html
翻页通过页码来控制:
# -*- coding: utf-8 -*-# @Author : Codeooo# @Time : 2023-02-09import gzip
import json
import time
import hashlib
import requests
deftest_6god(url, data):
god6_url ='http://119.91.218.111:9050/6god'
god_data ={"url": url,"headers": data,"token":"test",}
response = requests.post(god6_url, headers={}, data=god_data)return response.json()deftest_4god(url, data, cookies=""):
god6_url ='http://119.91.218.111:9051/4god'
god_data ={"url": url,"headers": data,"cookie": cookies,"token":"test",}
response = requests.post(god6_url, headers={}, data=god_data)return response.json()defmd5(str):
post_data = gzip.compress(bytes(json.dumps(str), encoding="utf8"))
m = hashlib.md5()
m.update(bytes(post_data))
str_md5 = m.hexdigest()return str_md5.upper()defget_keyword(device_id, iid, keyword, page, proxies):
url =f"https://aweme.snssdk.com/aweme/v1/search/item/?os_api=25&device_type=Pixel+XL&ssmix=a&manifest_version_code=180101&dpi=560&is_guest_mode=0&app_name=aweme&version_name=18.1.0&ts={int(time.time())}&cpu_support64=true&app_type=normal&appTheme=light&ac=wifi&host_abi=armeabi-v7a&channel=wandoujia_lesi_1128_0629&update_version_code=18109900&_rticket=1686903952535&device_platform=android&iid={iid}&version_code=180100&cdid=0528d7f9-bb0f-4d1d-b142-097951a0629d&os=android&is_android_pad=0&openudid=60a02c5de917fa4c&device_id={device_id}&package=com.ss.android.ugc.aweme&resolution=1440*2392&device_brand=google&language=zh&os_version=7.1.2&need_personal_recommend=1&aid=1128&minor_status=0"
data ={"keyword": keyword,"offset": page,"count":"12","source":"video_search","from_user":"","search_source":"switch_tab","is_pull_refresh":"1","hot_search":"0","search_id":"","query_correct_type":"1","is_filter_search":"0","sort_type":"0","publish_time":"0","search_range":"0","enter_from":"homepage_hot","backtrace":"","user_avatar_shrink":"64_64","video_cover_shrink":"372_496","previous_searchid":"20230616162541D17367263D89FB0029F7","switch_tab_from":"general","rs_word_count":"5","location_permission":"0","need_filter_settings":"1","enable_history":"1"}
headers ={"X-SS-STUB": md5(json.dumps(data)),"activity_now_client":str(int(time.time()*1000)),"x-ss-req-ticket":str(int(time.time()*1000)),"x-vc-bdturing-sdk-version":"2.2.1.cn","passport-sdk-version":"20356","sdk-version":"2","User-Agent":"okhttp/3.10.0.1",# "X-Ladon": "Fmwzchui1d9Bq4YebHART+PamP6awv5wq1ovcMlrm2Ugad0r",# "X-Khronos": "1686900009",# "X-Gorgon": "8404e04200056c703e652c97d023fd0577de3ae546915de0072d",# "X-Medusa": "Kw2MZB9hGQgcf9b/zdmRAeG19ULZNGJF1QWJQlIBamjbj/Jvc4gOGDJHatwPrzkMg3XHeDG/D1HWp23rFtOEze91VQd1RsEa0oZb9JEbfJLPJNDQTvP+Yg7DAYpO1k5Q9CNldKbv6FuGuqfFBt8Llx8lvbu16yxbwExrxXIDpxetUkw9Y4p9jc5y1MFT222L9ex/DJ4jDpe4HGchME2XQT/ygJNHJ12MFMYk/sTRYbDCuzWFe2rqErJSAVREY53HHU1ovFgXB2YKLqghSk/ZD+5/9a70i8x5D85aJMxUa8U6BN5gG6l8+5/hc+9p/NHXX2WcIEj+zXxZ2uDCOZPO9vn/LDpzYM4UGKRDIKk4SstUKCLgRL8A7NmXbwqGmfl7FXM1fXserhP59EXBBryjUbjRoxlf/Q==",# "X-Helios": "Jcqpen49rqhO8rTb/3E9G+N85U65yy4//vupPM33B6BaoQ6S",# "X-Argus": "XdYCNeAU12qsWMY0anSNeqWBmM4FNPLHXe4HY3C0VK/rVajjGV6+S2hnYoODLJX3A9a9dHM4UouytekIw+D/CWb1izuwO9LADIV+ro/5WxZJBriWVODiRk7mSQJJZQ5uCtgeVmd8YmfubtAI/QKG0L+EkhVvblnRY5fO8JxSSsrhM51/nfC7vAZ1csVCJh7fBf8L43dM5M+60NtwYVbBjM36nKcq1Kd1DKRq9oZfqHn/Za6DUDwf1ejq7+qh615hennjTaZSrg8YHodkHgfHzOYy","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8","Host":"aweme.snssdk.com","Cookie":f"install_id={iid};",}# headers.update(test_6god(url, json.dumps(data)))
headers.update(test_4god(url, json.dumps(data), headers["Cookie"]))# headers.update(test_4god(url, json.dumps(data)))
response = requests.post(url=url, headers=headers, data=data, proxies=proxies)print("====>", response.text)# print("====>", response.headers)if __name__ =='__main__':
proxies =None
device_id, iid ="3069485532583981","1368252763082152"
keyword ="成功"
get_keyword(device_id, iid, keyword,"12", proxies)
评论:
# -*- coding: utf-8 -*-# @Author : Codeooo# @Time : 2023-06-15import time
import requests
deftest_6god(url, data):
god6_url ='http://119.91.218.111:9050/6god'
god_data ={"url": url,"headers": data,"token":"test",}
response = requests.post(god6_url, headers={}, data=god_data)return response.json()deftest_4god(url, data, cookies=""):
god6_url ='http://119.91.218.111:23517/4god'
god_data ={"url": url,"headers": data,"cookie": cookies,"token":"test",}
response = requests.post(god6_url, headers={}, data=god_data)return response.json()defget_comment(device_id, iid, page, proxies):
url =f"https://aweme.snssdk.com/aweme/v2/comment/list/?aweme_id=7203360425642102072&cursor={page}&count=20&insert_ids&address_book_access=2&gps_access=2&forward_page_type=1&channel_id=0&city=310000&hotsoon_filtered_count=0&hotsoon_has_more=0&follower_count=0&is_familiar=0&page_source=0&user_avatar_shrink=64_64&aweme_author=MS4wLjABAAAAm4S0tfufQuiNdHFdh9bQ3IR1OZJ9in1iEXDjQpdzmSc&item_type=0&comment_aggregation=0&top_query_word=%E5%A5%B3%E5%AD%90%E6%8A%B1%E7%9D%80%E5%AD%A9%E5%AD%90%E7%94%B7%E5%AD%90%E5%A4%A7%E6%89%93%E5%87%BA%E6%89%8B%E5%90%8E%E7%BB%AD&os_api=25&device_type=SM-G988N&ssmix=a&manifest_version_code=180101&dpi=320&is_guest_mode=0&app_name=aweme&version_name=18.1.0&ts={int(time.time())}&cpu_support64=false&app_type=normal&appTheme=light&ac=wifi&host_abi=armeabi-v7a&channel=wandoujia_lesi_1128_0629&update_version_code=18109900&_rticket=1677204785764&device_platform=android&iid={iid}&version_code=180100&cdid=f0d57e33-e858-4fb6-a6d1-d5df9dc54561&os=android&is_android_pad=0&device_id={device_id}&package=com.ss.android.ugc.aweme&resolution=1080*1920&device_brand=samsung&language=zh&os_version=7.1.2&need_personal_recommend=1&aid=1128&minor_status=0&mcc_mnc=46007"
headers ={'Host':'aweme.snssdk.com','passport-sdk-version':'20356','sdk-version':'2',"activity_now_client":str(int(time.time()*1000)),"x-ss-req-ticket":str(int(time.time()*1000)),'x-vc-bdturing-sdk-version':'2.2.1.cn','user-agent':'okhttp/3.10.0.1'}# headers.update(test_6god(url, json.dumps(headers)))
headers.update(test_4god(url,"",""))
response = requests.get(url, headers=headers, proxies=proxies)print("====>", response.text)# print("====>", response.headers)if __name__ =='__main__':
proxies =None
device_id, iid ="3069485532583981","1368252763082152"
get_comment(device_id, iid,"0", proxies)
本文转载自: https://blog.csdn.net/weixin_38927522/article/details/131274919
版权归原作者 Codeooo 所有, 如有侵权,请联系我们删除。
版权归原作者 Codeooo 所有, 如有侵权,请联系我们删除。