Commit 52415bd1 by Fear1ess

4

parent 6277621e
import base64
import base64
import json
import time
import requests
from google.protobuf.json_format import MessageToJson
import tencentnews_pb2
url = 'https://minigame.ssp.qq.com/OpenChannel?qn-newsig=85b261f1c72eef2447836bf2dbfa6f364c91b6dbd31c4bcad86cfb5d73278b18'
headers = {
"Cookie": "lskey=;skey=;uin=; luin=;logintype=0; suid=8gMc3n5d74AYujvd5gd3; main_login=; imei=6e2669e5b2c47822",
"Referer": "http://inews.qq.com/inews/android/",
"User-Agent": "%E8%85%BE%E8%AE%AF%E6%96%B0%E9%97%BB6350(android)",
"Content-Type": "application/json",
"Host": "minigame.ssp.qq.com",
"Connection": "Keep-Alive",
"Accept-Encoding": "gzip",
"client-ip-v4": "1.119.145.230"
}
params1 = {
'refer': 'xw_1006',
'via': '',
}
params2 = {
'ext': '{\"req\":{\"m1\":\"3529335da2b435e9d902868b2ff53f21\",\"m2\":\"8546e52776e680212237d5047d32e01f\",\"m3\":\"cace17a6ecd05b5507daa08be80bc8b0\",\"muidtype\":1,\"muid\":\"3529335da2b435e9d902868b2ff53f21\",\"m11\":\"0101869F68498529763FE1450F84AC85F52F44936A8BA07976C38D939717C8C5AD932FF83ADE0C9B8B472CC0\",\"m10\":\"\",\"m9\":\"NfBv9ldwhM-cOQkHcT4DXstguYrnLGyTD1BZnUWRrNDOij_qGA-z13obzRFph1ngPtQZYOLgyW7XIgZ9FiGD59NkZaBT-AodCZHx-O6rNIAX3KvA0LqzKVpwRJH0DnKS\",\"placement_type\":1,\"render_type\":3,\"conn\":1,\"carrier\":0,\"loc_src\":4,\"support_app_landing_page\":1,\"c_os\":\"android\",\"c_osver\":\"8.1.0\",\"c_pkgname\":\"com.tencent.news\",\"c_device\":\"Pixel\",\"c_devicetype\":1,\"c_mf\":\"Google\",\"c_ori\":0,\"c_w\":1080,\"c_h\":1920,\"sdkver\":\"4.206.1076\",\"tmpallpt\":true,\"postype\":13,\"deep_link_version\":1,\"c_sdfree\":17947701248,\"c_market\":\"\",\"c_hl\":\"zh\",\"scs\":\"000170df116\",\"ast\":{\"br\":\"google\",\"de\":\"sailfish\",\"fp\":\"google\\/sailfish\\/sailfish:8.1.0\\/OPM4.171019.021.P1\\/4820305:user\\/release-keys\",\"hw\":\"sailfish\",\"pr\":\"sailfish\",\"sr\":\"FA6930307116\",\"is_d\":false},\"from_js\":0,\"sdk_st\":2,\"sdk_pt\":1,\"wx_api_ver\":0,\"opensdk_ver\":0,\"support_c2s\":2,\"support_component\":\"1,2,3\",\"ex_exp_info\":{\"exp_id\":[\"xq_click_exp_and_base_aa\",\"exp-unity-littleAPP-base\"],\"type\":7},\"source_from\":1110744484,\"hostappid\":\"1110744484\",\"hostver\":\"6.3.50\"}}',
'posid': '85563d6039bbe419d8b66ba51353603f',
'r': '0.7720362466314054',
'adposcount': '1',
'datatype': '2',
'count': '10',
'fc': '1'
}
txreq = tencentnews_pb2.TencentNewsMiniGameAdReq()
txreq.req_1 = 154
txreq.minisdk_version = 'V1_AND_MINISDK_1.5.1_0_RELEASE_B'
txreq.app_env = 'm=Pixel&o=8.1.0&a=27&p=1080*1794&f=Google&mm=3762&cf=1556&cc=4&qqversion=6.3.50'
txreq_4 = txreq.req_4
txreq_4_1 = txreq_4.req_4_1
for key,value in params1.items():
param = txreq_4_1.param.add()
param.key = key
param.value = value
txreq_4.gdt_inner_url = 'https://ii.gdt.qq.com/gdt_inner_view'
for key,value in params2.items():
param = txreq_4.param.add()
param.key = key
param.value = value
txreq_4.req_4_4 = '1110426504'
txreq_4.req_4_5 = 1
txreq.req_5 = '6e2669e5b2c47822_1217121419555_95320'
txreq.req_6 = 'mini_app_ad'
txreq.req_7 = 'GetAdForSdk'
txreq_8 = txreq.req_8
txreq_8.req_8_1 = '6e2669e5b2c47822'
txreq_8.req_8_2 = b'\x01\x01'
txreq_8.req_8_3 = '1012'
txreq_8.req_8_4 = 2
txreq_8_5 = txreq_8.req_8_5
txreq_8_5.req_8_5_6 = 0x3232393338333030
txreq_8.req_8_6 = ''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2lk\nEiA4NTU2M2Q2MDM5YmJlNDE5ZDhiNjZiYTUxMzUzNjAzZhoXCgFyEhIwLjc3MjAzNjI0NjYzMTQw\nNTQaDwoKYWRwb3Njb3VudBIBMRoNCghkYXRhdHlwZRIBMhoKCgVjb3VudBIBMRoHCgJmYxIBMSIK\nMTExMDQyNjUwNCgAKiQ2ZTI2NjllNWIyYzQ3ODIyXzEyMTcxMjE0MTk1NTVfOTUzMjAyC21pbmlf\nYXBwX2FkOgtHZXRBZEZvclNka0ItChA2ZTI2NjllNWIyYzQ3ODIyEgIBARoEMTAxMiACKgkxMDAz\nODM5MjIyADoAWAA=\n'
data = {
'request_data': b64data,
'timestamp': ts,
'nonce': 1027292128
}
res = requests.post(url, headers = headers, data = json.dumps(data))
content = res.json()
resdata = content.get("request_data")
respb = base64.b64decode(resdata)
rep = tencentnews_pb2.TencentNewsMiniGameAdRep()
rep.ParseFromString(respb)
adData = MessageToJson(rep)
adInfo = json.loads(adData).get('adInfo').get('data')
print(adInfo)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment