最新消息:20210917 已从crifan.com换到crifan.org

【已解决】用Charles+Postman+Python解密脚本分析小花生app中绘本接口和返回信息

接口 crifan 565浏览 0评论
折腾:
【记录】爬取小花生app中自主阅读馆和亲子阅读馆中的有音频的绘本数据
期间,已经得到了J字段的解密逻辑,且用python脚本实现了。
接下来要继续去用Charles+Nox夜神模拟器,继续分析剩余其他所有的和绘本相关的api请求。
并且配合Postman和Python解密脚本去获取和解析返回数据。
  • 自主阅读
    • api
    • 一共最多90个
      •     “J”: “{\”userId\”:\”1134723\”,\”fieldName\”:\”\”,\”fieldValue\”:\”全部类别\”,\”grades\”:\”\”,\”levels\”:\”\”,\”supportingResources\”:\”有音频\”,\”offset\”:90,\”limit\”:10}”,
  • 亲子阅读
    • api
    • 一共最多50个
      •     “J”: “{\”userId\”:\”1134723\”,\”fieldName\”:\”\”,\”fieldValue\”:\”全部类别\”,\”theStageOfTheChild\”:\”\”,\”parentalEnglishLevel\”:\”\”,\”supportingResources\”:\”有音频\”,\”offset\”:50,\”limit\”:10}”,
      • {“J”:”{\”userId\”:\”1134723\”,\”fieldName\”:\”\”,\”fieldValue\”:\”全部类别\”,\”theStageOfTheChild\”:\”\”,\”parentalEnglishLevel\”:\”\”,\”supportingResources\”:\”有音频\”,\”offset\”:0,\”limit\”:10}”,”C”:0}
对此,专门去Postman中测试,确保是可以返回数据的:
对于返回数据,解密后是这样的:
所以明显是:
pk=primary key=主键
然后分别对于每个book
再去调研接口
http://www.xiaohuasheng.cn:83/Reading.svc/viewEnglishSeries2/1134723/31

    GET /Reading.svc/viewEnglishSeries2/1134723/31 HTTP/1.1
Content-Type    application/json
Authorization    NSTp9~)NwSfrXp@\
userId    1134723
timestamp    xxx
signature    ab1bb13046493e8636e7db6fd61cc561
Content-Length    2
Host    
www.xiaohuasheng.cn:83
User-Agent    Mozilla/5.0 (Linux; U; Android 4.4.2; zh-cn; A0001 Build/KOT49H) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
Cookie    
ASP.NET_SessionId=qzj2da2eecobbcfjpndomktv
Cookie2    $Version=1
Accept-Encoding    gzip
Connection    keep-alive

{}

{
    "C": 2,
    "J": "H4sIAAAAAAAEAO1.......",
    "M": "1001",
    "ST": null
}
再去解析返回的信息
[
  {
    "pk": 31,
    "englishTitle": "Step Into Reading",
    "chineseTitle": "兰登分级阅读",
    "summaryInOneSentence": "美国主流分级读物",
    "poster": "",
    "picture": "",
    "lessonPlanId": 184136,
    "lessonPlanTitle": "英语启蒙阅读怎么做?Step Into Reading,从起步走向自主阅读",
    "lessonPlanSummary": "美国兰登书屋 Random House 的美系分级阅读代表读物:Step Into Reading (以下简称“SIR”)。下面分别介绍SIR1-4阶。 SIR1、2、3阶非常适合用来给孩子做英语阅读",
    "lessonPlanFirstPictureUrl": "
https://img.xiaohuasheng.cn/20180906144504394_f6109837926dc994ac9b2954dc569843.jpg
",
    "publishingHouse": "Penguin Random House(美国)",
    "publishingCountry": "美国",
    "award": "",
    "supportingResources": "有音频 · 可点读",
    "levelCount": 4,
    "bookCount": 117,
    "bookId": 35764,
    "audioCount": 330,
    "bookCommentCount": 1474,
    "experienceCount": 16,
    "minPrice": 150,
    "maxPrice": 492,
    "youzanItemId": 422614892,
    "youzanItemDetailUrl": "
https://h5.youzan.com/v2/showcase/goods?alias=1ylb20vitdct2&from=wsc&kdtfrom=wsc
",
    "whitePaperCount": 2,
    "levelArrayJson": "....
..........
  }
]
兰登分级阅读 Step Into Reading 国外主流分级读物
还有对应网页版,其中有公开的很多数目的信息
点击 包含图书
看起来涉及到2个请求:
http://www.xiaohuasheng.cn:83/Reading.svc/queryEnglishSeriesBook/1134723/31/-1/0/
http://www.xiaohuasheng.cn:83/Reading.svc/getLevelForQueryEnglishSeriesBook/1134723/31 
然后去研究返回结果
对于:
http://www.xiaohuasheng.cn:83/Reading.svc/queryEnglishSeriesBook/1134723/31/-1/0/10
返回:
对应着界面:
继续进去每本看看信息
UI
接口:
http://www.xiaohuasheng.cn:83/Reading.svc/getServerBookInfo17/1134723/120.136174/28.997280/109512/10
后来一次:
http://www.xiaohuasheng.cn:83/Reading.svc/getServerBookInfo17/1134723/120.136174/28.997280/109512/10
后记:
此处的:
  • 120.136174
  • 28.997280
先后两次调试,都是一样的,没变
-》去Charles中搜
28.997280
找到:
-》推测是:
  • 经度:120.136174
  • 维度:28.997280
api中,填上固定的经纬度,估计就可以了。
而:
  • 109512
    • 是前面单个seriesBook的pk,即id
  • 10
    • 没找到出处
    • 且去看了其他book,也是10
    • 暂时就用固定值10吧
    • 后记:看到源码中,还的确就是经纬度和固定的10
解析后:
[
  {
    "pk": 109512,
    "guid": "7544feaa26aae582",
    "isbn13": "9780375912306",
    "name": "Step into Reading 1: Happy Alphabet!",
    "author": "Anna Jane Hays, Joe Mathieu (Illustrator)",
    "translator": "",
    "press": "LucasBooks for Young Readers",
    "awards": "",
    "publishDate": "2000-3",
    "frontCover": "149/Book/20160930171033.png",
    "frontCoverWidth": 355,
    "frontCoverHeight": 552,
    "introduction": "A string of wacky people, animals, and objects, each beginning with a different letter of the alphabet, gather to celebrate a birthday! Each page presents a letter of the alphabet, and every phrase rhymes with the next to help beginning readers anticipate words!\r\n\r\n\r\nFrom the Trade Paperback edition.",
    "dangdangLink": "",
    "amazonLink": "http://www.amazon.com/Star-Wars-Episode-Anakins-Reading/dp/0375804315/ref=sr_1_1?s=books&ie=UTF8&qid=1441894607&sr=1-1&keywords=0090129003990",
    "jdLink": "",
    "jdSkuId": "",
    "downloadLink": "",
    "amazonPrice": 0.01,
    "commentCount": 21,
    "booklistCount": 65,
    "creator": 149,
    "seriesTitle": "Step into Reading",
    "chineseOrForeignLanguageBookName": "",
    "edition": "",
    "sizeOfTheBook": "",
    "pages": "",
    "wordCount": "",
    "tableOfContents": "",
    "ar": "1.1",
    "ownedCategories": "",
    "isEnglish": 1,
    "star": 4.722,
    "scoreCount": 625,
    "bookCommentChildCount": 584,
    "favoriteCount": 74,
    "goodCommentCount": 19,
    "badCommentCount": 1,
    "inPageCommentCount": 3,
    "readingChildCount": 588,
    "readingUserCount": 593,
    "atosBookLevel": "1.1",
    "interestLevel": "Lower Grades (LG K-3)",
    "arPoints": "0.5",
    "arWordCount": "168",
    "fictionNonfiction": "Nonfiction",
    "topicSubtopic": "Alphabet/Counting Books-Alphabet Books; Poetry/Rhymes-Stories in Rhyme;",
    "booklistsJson": "[{\"type\":1,\"pk\":276,\"name\":\"英语学习路:学自然拼读(Phonics)的书\",\"bookCount\":50,\"favoriteCount\":252,\"recommendUserCount\":375,\"frontCover\":\"\"},{\"type\":1,\"pk\":245,\"name\":\"英语学习路:刚开始,寻找字母书(Alphabet Books)!\",\"bookCount\":69,\"favoriteCount\":169,\"recommendUserCount\":241,\"frontCover\":\"\"},{\"type\":2,\"pk\":19655,\"name\":\"兰登分级1 ready to read共计30本\",\"bookCount\":30,\"favoriteCount\":38,\"frontCover\":\"\"},{\"type\":2,\"pk\":2148,\"name\":\"优优0-36个月的绘本阅读清单!\",\"bookCount\":484,\"favoriteCount\":12,\"frontCover\":\"\"},{\"type\":2,\"pk\":47982,\"name\":\"兰登分级一级30本\",\"bookCount\":30,\"favoriteCount\":6,\"frontCover\":\"\"},{\"type\":2,\"pk\":14262,\"name\":\"绵绵2018英文书单\",\"bookCount\":163,\"favoriteCount\":2,\"frontCover\":\"\"}]",
    "rbrsJson": "[]",
    "latestCommentJson": 
......
然后返回页面后,继续下来相关的绘本:
对应接口是:
http://www.xiaohuasheng.cn:83/Reading.svc/queryEnglishSeriesBook/1134723/31/-1/20/10
很明显,url中最后参数表示offset和limit
再点击 包含音频:
接口,2个:
http://www.xiaohuasheng.cn:83/Reading.svc/getLevelForQueryEnglishSeriesAudio/1134723/31

http://www.xiaohuasheng.cn:83/Reading.svc/queryEnglishSeriesAudio/1134723/31/-1/1/0/10
先说:
http://www.xiaohuasheng.cn:83/Reading.svc/getLevelForQueryEnglishSeriesAudio/1134723/31
解析后:
[
  {
    "pk": -1,
    "name": "全部"
  },
  {
    "pk": 79,
    "name": "Level 1"
  },
  {
    "pk": 80,
    "name": "Level 2"
  },
  {
    "pk": 81,
    "name": "Level 3"
  }
]
-》
  • 之前的-1,估计都是表示全部的pk=primary key
    • 等于全部搜索
  • 此处的level 1+2+3共240
    • 也不等于后面界面上的330啊
再说:
http://www.xiaohuasheng.cn:83/Reading.svc/queryEnglishSeriesAudio/1134723/31/-1/1/0/10
解析后:
[
  {
    "pk": 1808,
    "title": "Bear Hugs ",
    "picture": "EnglishLevelFrontCoverOrInnerPage/79/封面.jpg",
    "audioCount": 5
  },
  {
    "pk": 1809,
    "title": "Big Egg",
    "picture": "EnglishLevelFrontCoverOrInnerPage/79/封面.jpg",
    "audioCount": 5
  },
  {
    "pk": 1810,
    "title": "Boats",
    "picture": "EnglishLevelFrontCoverOrInnerPage/79/封面.jpg",
    "audioCount": 5
  },
  {
    "pk": 1811,
    "title": "Cats Traps",
    "picture": "EnglishLevelFrontCoverOrInnerPage/79/封面.jpg",
    "audioCount": 5
  },
  {
    "pk": 1812,
    "title": "City Cats, Country Cats ",
    "picture": "EnglishLevelFrontCoverOrInnerPage/79/封面.jpg",
    "audioCount": 5
  },
  {
    "pk": 1813,
    "title": "Corn Aplenty ",
    "picture": "EnglishLevelFrontCoverOrInnerPage/79/封面.jpg",
    "audioCount": 5
  },
  {
    "pk": 1814,
    "title": "Dancing Dinos Go to School",
    "picture": "EnglishLevelFrontCoverOrInnerPage/79/封面.jpg",
    "audioCount": 5
  },
  {
    "pk": 1815,
    "title": "Dancing Dinos",
    "picture": "EnglishLevelFrontCoverOrInnerPage/79/封面.jpg",
    "audioCount": 5
  },
  {
    "pk": 1816,
    "title": "Dragon Egg ",
    "picture": "EnglishLevelFrontCoverOrInnerPage/79/封面.jpg",
    "audioCount": 5
  },
  {
    "pk": 1817,
    "title": "Ducks Go Vroom",
    "picture": "EnglishLevelFrontCoverOrInnerPage/79/封面.jpg",
    "audioCount": 5
  }
]
界面进入:
再进去某个子页面:
接口:
http://www.xiaohuasheng.cn:83/Reading.svc/viewAudioPackage/1134723/1808/1
返回:
解析后:
[
  {
    "pk": 1808,
    "title": "Bear Hugs ",
    "picture": "EnglishLevelFrontCoverOrInnerPage/79/封面.jpg",
    "audioCount": 5,
    "bookSeriesId": 79,
    "bookSeriesChineseTitle": "兰登分级阅读第1级",
    "bookSeriesEnglishTitle": "Step Into Reading Level 1",
    "bookSeriesPicture": "EnglishLevelFrontCoverOrInnerPage/79/封面.jpg",
    "audioArrayJson": "[{\"pk\":6497,\"picture\":\"EnglishLevelFrontCoverOrInnerPage/79/封面.jpg\",\"path\":\"Audio/1808/20180911222508831.mp3\",\"extension\":\".mp3\",\"title\":\"1. Bear Hugs-Listen and Repeat\",\"size\":1735488,\"duration\":433,\"sizeString\":\"1.7M\",\"durationString\":\"07:13\",\"packageName\":\"Bear Hugs \"},{\"pk\":6498,\"picture\":\"EnglishLevelFrontCoverOrInnerPage/79/封面.jpg\",\"path\":\"Audio/1808/20180911222513404.mp3\",\"extension\":\".mp3\",\"title\":\"2. Bear Hugs-Listening Test\",\"size\":687312,\"duration\":171,\"sizeString\":\"671KB\",\"durationString\":\"02:51\",\"packageName\":\"Bear Hugs \"},{\"pk\":6499,\"picture\":\"EnglishLevelFrontCoverOrInnerPage/79/封面.jpg\",\"path\":\"Audio/1808/20180911222516379.mp3\",\"extension\":\".mp3\",\"title\":\"3. Bear Hugs-the Chant\",\"size\":150912,\"duration\":37,\"sizeString\":\"147KB\",\"durationString\":\"00:37\",\"packageName\":\"Bear Hugs \"},{\"pk\":6500,\"picture\":\"EnglishLevelFrontCoverOrInnerPage/79/封面.jpg\",\"path\":\"Audio/1808/20180911222517198.mp3\",\"extension\":\".mp3\",\"title\":\"4. Bear Hugs-the Song\",\"size\":210816,\"duration\":52,\"sizeString\":\"205KB\",\"durationString\":\"00:52\",\"packageName\":\"Bear Hugs \"},{\"pk\":6501,\"picture\":\"EnglishLevelFrontCoverOrInnerPage/79/封面.jpg\",\"path\":\"Audio/1808/20180911222518130.mp3\",\"extension\":\".mp3\",\"title\":\"5. Bear Hugs-the Story\",\"size\":1398528,\"duration\":349,\"sizeString\":\"1.3M\",\"durationString\":\"05:49\",\"packageName\":\"Bear Hugs \"}]"
  }
]
其中有我们要的audio的url
\"path\":\"Audio/1808/20180911222508831.mp3\"
其中第一个是:
"pk\":6497
不过也去点击音频播放,看看是否请求对应url
进入播放音频界面:
接口:
可见:
先去:
http://www.xiaohuasheng.cn:83/Reading.svc/getAllAudioInPackageByAudioId/1134723/6497
再去:
https://img.xiaohuasheng.cn/Audio/1808/20180911222508831.mp3
对于:
http://www.xiaohuasheng.cn:83/Reading.svc/getAllAudioInPackageByAudioId/1134723/6497
返回:
解析后:
[
  {
    "pk": 6497,
    "picture": "EnglishLevelFrontCoverOrInnerPage/79/封面.jpg",
    "path": "Audio/1808/20180911222508831.mp3",
    "extension": ".mp3",
    "title": "1. Bear Hugs-Listen and Repeat",
    "size": 1735488,
    "duration": 433,
    "sizeString": "1.7M",
    "durationString": "07:13",
    "packageName": "Bear Hugs "
  },
  {
    "pk": 6498,
    "picture": "EnglishLevelFrontCoverOrInnerPage/79/封面.jpg",
    "path": "Audio/1808/20180911222513404.mp3",
    "extension": ".mp3",
    "title": "2. Bear Hugs-Listening Test",
    "size": 687312,
    "duration": 171,
    "sizeString": "671KB",
    "durationString": "02:51",
    "packageName": "Bear Hugs "
  },
  {
    "pk": 6499,
    "picture": "EnglishLevelFrontCoverOrInnerPage/79/封面.jpg",
    "path": "Audio/1808/20180911222516379.mp3",
    "extension": ".mp3",
    "title": "3. Bear Hugs-the Chant",
    "size": 150912,
    "duration": 37,
    "sizeString": "147KB",
    "durationString": "00:37",
    "packageName": "Bear Hugs "
  },
  {
    "pk": 6500,
    "picture": "EnglishLevelFrontCoverOrInnerPage/79/封面.jpg",
    "path": "Audio/1808/20180911222517198.mp3",
    "extension": ".mp3",
    "title": "4. Bear Hugs-the Song",
    "size": 210816,
    "duration": 52,
    "sizeString": "205KB",
    "durationString": "00:52",
    "packageName": "Bear Hugs "
  },
  {
    "pk": 6501,
    "picture": "EnglishLevelFrontCoverOrInnerPage/79/封面.jpg",
    "path": "Audio/1808/20180911222518130.mp3",
    "extension": ".mp3",
    "title": "5. Bear Hugs-the Story",
    "size": 1398528,
    "duration": 349,
    "sizeString": "1.3M",
    "durationString": "05:49",
    "packageName": "Bear Hugs "
  }
]
即:
把相关音频文件地址都获取到了。
剩下的,就是看如何借助于postman去分析接口,如何写代码模拟爬取数据了。
【已解决】PySpider中用Python代码爬取小花生app中绘本数据

转载请注明:在路上 » 【已解决】用Charles+Postman+Python解密脚本分析小花生app中绘本接口和返回信息

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
92 queries in 0.174 seconds, using 23.47MB memory