筆記——抓包工具抓取手機app內容

Fiddler爬取手機app安裝設置:html

1.tools->Options->HTTPS
勾:Decrypt HTTPS traffic
	//勾:Ignore server certificate errors(unsafe)
	//Check for certificate revocation
	//取消掉Check for certificate revocation
2.點Connections
	勾:Allow remote computers to connect
ok
3.打開手機(手機和pc必須在同一網段中)
點設置->WLAN->無線網名->手動設置代理->
	主機名:pc所在的ip地址
	端口:8888
4.點開wawayaya軟件->點擊課本點讀->查看Fiddler
5.點擊左側json類型文件->查看右下->點json->查看是否含有downloadurl
6.右鍵左側json類型文件->save->open as local File...->打開json文件->另存
7.python寫下載代碼

 編寫wawayaya.py文件:python

#-*- coding: UTF-8 -*-
from urllib.request import urlretrieve
import requests
import os

def clas_imgs_download(clas_url,header):
    req = requests.get(url = clas_url, headers = header).json()
    a = req['retinfo']
    clas_num = len(a['libList'])
    print('一共有%d個分類' % clas_num)
    clas_images_path = 'hero_images'
    for each_clas in a["libList"]:
        clas_photo_url = each_clas['imageEn']
        clas_name = each_clas['cname'] + '.png'
        filename = clas_images_path + '/' + clas_name
        if clas_images_path not in os.listdir():
            os.makedirs(clas_images_path)
        urlretrieve(url = clas_photo_url, filename = filename)

if __name__ == '__main__':
    headers = {'Accept-Charset': 'UTF-8',
            'Accept-Encoding': 'gzip',
            'User-Agent': 'Dalvik/2.1.0 (Linux; U; Android 7.0; Android 7.0; TRT-AL00A Build/HUAWEITRT-AL00A)',
            'X-Requested-With': 'XMLHttpRequest',
            'Content-type': 'application/x-www-form-urlencoded',
            'Connection': 'Keep-Alive',
            'Host': 'api3-joyreader.wawayaya.com'}
    clas_url = "http://api3-joyreader.wawayaya.com/api/server/book/getLibHomeList?deviceType=phone&client_lang=zh&appVer=3.8.6&userId=610408&uuid=android_6344e185764b08fd55309dfa95532b1e&platform=android&osVer=24&mac=02:00:00:00:00:00&token=39e332500dd3c256b860e776a1f9407d&sig=55916d7f&countryCode=CN&appId=2209410&app_ver=3.8.6&imei=864665031586774&timestamp=1513069338403"
    #req = requests.get(url = heros_url, headers = headers).json()
    # a=req["retinfo"]
    # b=a["data"]
    clas_imgs_download(clas_url,headers)

  代碼說明:android

(1):當運行出現:urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED]
 certificate verify failed (_ssl.c:749)>錯誤時
解決連接:
https://www.cnblogs.com/kill0001000/p/5807579.html

(2):參拷文獻:
http://blog.csdn.net/c406495762/article/details/76850843
相關文章
相關標籤/搜索