免責聲明
七麥數據(原ASO100)是七麥科技推出的國內專業的移動應用數據分析平臺,是國內同時打通App數據、微信公衆號數據、小程序數據的數據分析平臺。
軟件均僅用於學習交流,請勿用於任何商業用途!感謝你們!
javascript
運行環境
Version: Python3html
獲取qimai_jsdata.js
點這裏java
Python代碼
# !/user/bin/env python # -*- coding:utf-8 -*- # time: 2020/08/24---17:07 __author__ = 'Hefengyang' ''' 項目:七麥數據徹底版 榜單分類:brand_id/{}---2:暢銷榜 1: 免費榜 0:付費榜 ''' import requests,execjs,json,base64,time with open('qimai_jsdata.js', encoding='utf-8') as f: jsdata = f.read() jsdata = execjs.compile(jsdata) # 只須要傳入url(brand_id)和params(篩選條件) headers = { "Accept": "application/json, text/plain, */*", "Referer": "https://www.qimai.cn/rank", "User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/59.0", "cookie": "你登陸七麥生成的cookie" } api_domain = 'https://api.qimai.cn' url = '/rank/indexPlus/brand_id/1' params = { 'brand':'all', 'device':'iphone', 'country':'cn', 'genre':'5000', 'date':'2020-08-24', } params_str = [] for i in params: params_str.append(params[i]) # print(params_str) # 自定義加密函數 def encrypt(a): e = '00000008d78d46a' t = len(e) n = len(a) a = list(a) for s in range(n): a[s] = chr(ord(a[s]) ^ ord(e[(s + 10) % t])) return ''.join(a) def main(): api_url = api_domain + url # iPhone 免費榜單 # 提取查詢參數值並排序 s = "".join(sorted([str(v) for v in params.values()])) # Base64 Encode s = base64.b64encode(bytes(s, encoding="ascii")) # 時間差 t = str(int((time.time() * 1000))) # 拼接自定義字符串 s = "@#".join([s.decode(), api_url, t, "1"]) # 自定義加密 & Base64 Encode s = base64.b64encode(bytes(encrypt(s), encoding="ascii")) # 拼接 URL params["analysis"] = s.decode() analysis = jsdata.call('get_analysis',api_url,params_str) # print(analysis) params['analysis'] = analysis html = requests.get(api_url,params=params,headers=headers) return html if __name__ == '__main__': html = main() print(html.json())
下面是我請求後的結果
{ 'code': 10000, 'msg': '成功', 'time': '08月24日 17:23', 'list': [{ 'index': 1, 'appInfo': { 'appId': '1496121983', 'appName': '花小豬打車-出行打車全網超低一口價', 'icon': 'https://is2-ssl.mzstatic.com/image/thumb/Purple124/v4/77/dc/1b/77dc1bf4-ed47-d9da-22df-476e16989a83/AppIcon-0-0-1x_U007emarketing-0-0-0-5-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/180x180bb.png', 'publisher': 'Beijing HongYiBo Technology Co., Ltd', 'country': 'cn', 'file_size': '140687360', 'price': '0.00', 'continuousFirstDays': 4 }, 'class': { 'ranking': 1 }, 'change': 0, 'genre': '旅遊', 'appGenre': '應用', 'publisher_id': '1496121982' }, { 'index': 2, 'appInfo': { 'appId': '1012871328', 'appName': '得物(毒)-有毒的運動X潮流X好物', 'icon': 'https://is1-ssl.mzstatic.com/image/thumb/Purple114/v4/0c/9f/18/0c9f185c-16a8-a708-b8e0-0e844bc8fd36/source/100x100bb.jpg', 'publisher': 'Shanghai Shi Zhuang Information Technology Co.,Ltd.', 'country': 'cn', 'file_size': '378606592', 'price': '0.00' }, 'class': { 'ranking': 1 }, 'change': 0, 'genre': '體育', 'appGenre': '應用', 'publisher_id': '1114287620' }, { 'index': 3, 'appInfo': { 'appId': '1044283059', 'appName': '拼多多-拼着買,才便宜', 'icon': 'https://is1-ssl.mzstatic.com/image/thumb/Purple114/v4/7b/fc/36/7bfc3657-c4c4-e1bd-e98c-aedd6337e9fc/AppIcon-0-0-1x_U007emarketing-0-0-0-10-0-0-85-220.png/180x180bb.png', 'publisher': '上海尋夢信息技術有限公司', 'country': 'cn', 'file_size': '224289792', 'price': '0.00' }, 'class': { 'ranking': 1 }, 'change': 0, 'genre': '購物', 'appGenre': '應用', 'publisher_id': '1044283058' }, { 'index': 4, 'appInfo': { 'appId': '1458072671', 'appName': '剪映 - 輕而易剪', 'icon': 'https://is4-ssl.mzstatic.com/image/thumb/Purple114/v4/32/3b/7b/323b7bae-0bde-2e0d-dc0e-f482ecf65236/AppIcon-0-0-1x_U007emarketing-0-0-0-7-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/180x180bb.png', 'publisher': '深圳市臉萌科技有限公司', 'country': 'cn', 'file_size': '131038208', 'price': '0.00' }, 'class': { 'ranking': 1 }, 'change': 3, 'genre': '攝影與錄像', 'appGenre': '應用', 'publisher_id': '764976186' }, { 'index': 5, 'appInfo': { 'appId': '414478124', 'appName': '微信', 'icon': 'https://is5-ssl.mzstatic.com/image/thumb/Purple114/v4/52/25/cb/5225cb34-00d0-3798-eeb5-ac10a616225f/AppIcon-0-0-1x_U007emarketing-0-0-0-4-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/180x180bb.png', 'publisher': 'WeChat', 'country': 'cn', 'file_size': '339382272', 'price': '0.00' }, 'class': { 'ranking': 1 }, 'change': -1, 'genre': '社交', 'appGenre': '應用', 'publisher_id': '614694882' }, { 'index': 6, 'appInfo': { 'appId': '1142110895', 'appName': ' 抖音短視頻 ', 'icon ': 'https: //is5-ssl.mzstatic.com/image/thumb/Purple114/v4/3a/cc/4e/3acc4e47-86dd-8b6d-63c5-5bb9f3e37f4a/AppIcon-1x_U007emarketing-0-6-0-85-220.png/180x180bb.png', 'publisher': 'Beijing Microlive Vision Technology Co., Ltd', 'country': 'cn', 'file_size': '471684096', 'price': '0.00'}, 'class': {'ranking': 2}, 'change': -1, 'genre': '攝影與錄像', 'appGenre': '應用', 'publisher_id': '1170416082'}, {'index': 7, 'appInfo': {'appId': '423084029', 'appName': '美團-吃喝玩樂 盡在美團', 'icon': 'https://is3-ssl.mzstatic.com/image/thumb/Purple114/v4/96/52/da/9652da63-406e-6d8a-cd9f-d439771719cd/AppIcon-0-0-1x_U007emarketing-0-0-0-6-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/180x180bb.png', 'publisher': '美團', 'country': 'cn', 'file_size': '299753472', 'price': '0.00'}, 'class': {'ranking': 1}, 'change': 1, 'genre': '生活', 'appGenre': '應用', 'publisher_id': '423084032'}, {'index': 8, 'appInfo': {'appId': '1039727169', 'appName': '交管12123', 'icon': 'https://is2-ssl.mzstatic.com/image/thumb/Purple124/v4/c4/d7/d1/c4d7d1a3-d05d-4430-7235-e4244fcbaeea/AppIcon-1x_U007emarketing-0-4-0-0-85-220.png/180x180bb.png', 'publisher': '公安部交通管理科學研究所', 'country': 'cn', 'file_size': '100673536', 'price': '0.00'}, 'class': {'ranking': 2}, 'change': 11, 'genre': '生活', 'appGenre': '應用', 'publisher_id': '1039727168'}, {'index': 9, 'appInfo': {'appId': '590338362', 'appName': '網易雲音樂-音樂的力量', 'icon': 'https://is5-ssl.mzstatic.com/image/thumb/Purple124/v4/f7/e1/23/f7e1235d-a131-d5b4-d092-4423956cb253/AppIcon-0-0-1x_U007emarketing-0-0-0-6-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/180x180bb.png', 'publisher': '杭州網易雲音樂科技有限公司', 'country': 'cn', 'file_size': '438467584', 'price': '0.00'}, 'class': {'ranking': 1}, 'change': -3, 'genre': '音樂', 'appGenre': '應用', 'publisher_id': '1202760281'}, {'index': 10, 'appInfo': {'appId': '444934666', 'appName': 'QQ', 'icon': 'https://is5-ssl.mzstatic.com/image/thumb/Purple124/v4/ea/f4/dd/eaf4dd50-9cbf-c4fe-d9ea-8cca720904d7/AppIcon-1-1x_U007emarketing-0-7-0-0-85-220.png/180x180bb.png', 'publisher': 'Tencent Technology (Shenzhen) Company Limited', 'country': 'cn', 'file_size': '514864128', 'price': '0.00'}, 'class': {'ranking': 2}, 'change': -1, 'genre': '社交', 'appGenre': '應用', 'publisher_id': '292374531'}, {'index': 11, 'appInfo': {'appId': '333206289', 'appName': '支付寶 - 生活好 支付寶', 'icon': 'https://is2-ssl.mzstatic.com/image/thumb/Purple114/v4/a6/db/c1/a6dbc189-ccde-534f-1f0d-f87ca7f188c3/AppIcon-0-0-1x_U007emarketing-0-0-0-7-0-0-85-220.png/180x180bb.png', 'publisher': 'Alipay (Hangzhou) Technology Co., Ltd.', 'country': 'cn', 'file_size': '365416448', 'price': '0.00'}, 'class': {'ranking': 3}, 'change': -1, 'genre': '生活', 'appGenre': '應用', 'publisher_id': '333206292'}, {'index': 12, 'appInfo': {'appId': '741292507', 'appName': '小紅書 – 標記個人生活', 'icon': 'https://is4-ssl.mzstatic.com/image/thumb/Purple114/v4/af/fb/11/affb1109-3d16-b901-7679-2349a3ca7683/AppIcon-0-0-1x_U007emarketing-0-0-0-7-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/180x180bb.png', 'publisher': 'Xingin', 'country': 'cn', 'file_size': '473981952', 'price': '0.00'}, 'class': {'ranking': 3}, 'change': -1, 'genre': '社交', 'appGenre': '應用', 'publisher_id': '708264912'}, {'index': 13, 'appInfo': {'appId': '387682726', 'appName': '手機淘寶 - 淘到你說好', 'icon': 'https://is4-ssl.mzstatic.com/image/thumb/Purple124/v4/e7/0d/b6/e70db610-3e6d-88ce-08d3-fac58a7f7233/AppIcon-0-1x_U007emarketing-0-9-0-0-sRGB-0-85-220.png/180x180bb.png', 'publisher': 'Taobao (China) Software CO.,LTD', 'country': 'cn', 'file_size': '471324672', 'price': '0.00'}, 'class': {'ranking': 2}, 'change': 0, 'genre': '購物', 'appGenre': '應用', 'publisher_id': '387682729'}, {'index': 14, 'appInfo': {'appId': '629774477', 'appName': '芒果TV', 'icon': 'https://is5-ssl.mzstatic.com/image/thumb/Purple114/v4/40/f1/93/40f1935d-9750-1dcf-2350-253eb73680e2/AppIcon-0-0-1x_U007emarketing-0-0-0-5-0-0-0-0-85-220.png/180x180bb.png', 'publisher': '快樂陽光', 'country': 'cn', 'file_size': '286025728', 'price': '0.00'}, 'class': {'ranking': 1}, 'change': -2, 'genre': '娛樂', 'appGenre': '應用', 'publisher_id': '367207223'}, {'index': 15, 'appInfo': {'appId': '382201985', 'appName': '百度', 'icon': 'https://is3-ssl.mzstatic.com/image/thumb/Purple124/v4/40/05/01/400501cd-b8c4-32a5-b44f-a68cd7875509/AppIcon-0-0-1x_U007emarketing-0-0-0-7-0-0-sRGB-85-220.jpeg/180x180bb.png', 'publisher': 'Beijing Baidu Netcom Science & Technology Co.,Ltd', 'country': 'cn', 'file_size': '329801728', 'price': '0.00'}, 'class': {'ranking': 1}, 'change': 1, 'genre': '工具', 'appGenre': '應用', 'publisher_id': '372585298'}, {'index': 16, 'appInfo': {'appId': '1340376323', 'appName': '淘寶特價版 - 會省會花上特價', 'icon': 'https://is4-ssl.mzstatic.com/image/thumb/Purple114/v4/42/be/9f/42be9f00-f305-9304-d694-5b7799600133/AppIcon-0-0-1x_U007emarketing-0-0-0-7-0-0-sRGB-85-220.png/180x180bb.png', 'publisher': 'Taobao (China) Software CO.,LTD', 'country': 'cn', 'file_size': '211318784', 'price': '0.00'}, 'class': {'ranking': 3}, 'change': 2, 'genre': '購物', 'appGenre': '應用', 'publisher_id': '387682729'}, {'index': 17, 'appInfo': {'appId': '691828408', 'appName': '微視-短視頻創做與分享', 'icon': 'https://is5-ssl.mzstatic.com/image/thumb/Purple114/v4/fd/df/51/fddf51be-9f10-c373-047a-7198426c4998/source/100x100bb.jpg', 'publisher': 'Tencent Technology (Beijing) Company Limited', 'country': 'cn', 'file_size': '303346688', 'price': '0.00'}, 'class': {'ranking': 3}, 'change': -3, 'genre': '攝影與錄像', 'appGenre': '應用', 'publisher_id': '542280115'}, {'index': 18, 'appInfo': {'appId': '461703208', 'appName': '高德地圖-精準智能導航,出行必備', 'icon': 'https://is2-ssl.mzstatic.com/image/thumb/Purple124/v4/37/03/7c/37037c6c-abf3-299f-dab5-b8fedb279304/AppIcon-1x_U007emarketing-0-6-0-0-85-220.png/180x180bb.png', 'publisher': 'AutoNavi Information Technology Co. Ltd.', 'country': 'cn', 'file_size': '249520128', 'price': '0.00'}, 'class': {'ranking': 1}, 'change': 2, 'genre': '導航', 'appGenre': '應用', 'publisher_id': '300625629'}, {'index': 19, 'appInfo': {'appId': '393765873', 'appName': '愛奇藝-中國新說唱獨播', 'icon': 'https://is2-ssl.mzstatic.com/image/thumb/Purple114/v4/fe/df/2e/fedf2e2d-1351-f15b-6458-0c025e8b5570/AppIcon-0-1x_U007emarketing-0-5-0-0-85-220.png/180x180bb.png', 'publisher': 'QIYI', 'country': 'cn', 'file_size': '390140928', 'price': '0.00' }, 'class': { 'ranking': 2 }, 'change': -2, 'genre': '娛樂', 'appGenre': '應用', 'publisher_id': '387327025' }, { 'index': 20, 'appInfo': { 'appId': '930368978', 'appName': '釘釘', 'icon': 'https://is2-ssl.mzstatic.com/image/thumb/Purple124/v4/06/77/91/067791fe-8849-27f3-92c0-95a99f3dcc59/AppIcon-0-0-1x_U007emarketing-0-0-0-6-0-0-sRGB-85-220.png/180x180bb.png', 'publisher': 'DingTalk (China) Information Technology Co., Ltd.', 'country': 'cn', 'file_size': '392731648', 'price': '0.00' }, 'class': { 'ranking': 1 }, 'change': 10, 'genre': '商務', 'appGenre': '應用', 'publisher_id': '1435447040' }] }
獲取qimai_jsdata.js
點這裏python