笔记——抓包工具抓取手机app内容

Fiddler爬取手机app安装设置:

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文件:

#-*- 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)

  代码说明:

(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

  

原文地址:https://www.cnblogs.com/yongxinboy/p/8029319.html