IT编程iOS 开发 iOS Developer

原创教程:Charles抓包与解析 (三) : 某App抓包数据

2016-04-02  本文已影响2521人  疯狂的向日葵

版权声明:本文为博主原创文章,未经博主允许不得转载。

教程合辑:

1.原创教程:Charles抓包与解析 (一) : Charles安装及使用
2.原创教程:Charles抓包与解析 (二) : 某App抓包数据分析(上)
3.原创教程:Charles抓包与解析 (三) : 某App抓包数据分析(下)
4.原创教程:Charles抓包与解析 (四) : H5和Native交互的实现

原创教程:Charles抓包与解析 (三) : 某App抓包数据分析(中)

Chapter 2 : 首页"精选"接口分析.

PS.Charles 打开,手机WiFi设置好.(按教程 一)

1.首页有点复杂,分三部分

1.banners
2.中间四个小按钮
3.下面的tableview


首页.PNG

2.Banners

Banners 接口直接可以看到:
http://maimenghuo.com/v2/banners?channel=iOS
Banners的JSON数据

{
    "code": 200,
    "data": {
        "banners": [{
            "id": 132,
            "image_url": "http://7xkwn3.com1.z0.glb.clouddn.com/image/160331/08nuxlzl5.jpg-w720",
            "order": 132,
            "status": 0,
            "target": {
                "banner_image_url": "http://7xkwn3.com1.z0.glb.clouddn.com/image/160331/mqi7z1h64.jpg-w300",
                "cover_image_url": "http://7xkwn3.com1.z0.glb.clouddn.com/image/160331/vp0ycx4s6.jpg-w720",
                "created_at": 1459463400,
                "id": 72,
                "posts_count": 5,
                "status": 0,
                "subtitle": "整蛊无罪 愚人有理",
                "title": "愚人节快乐!",
                "updated_at": 1459413920
            },
            "target_id": 72,
            "target_url": "",
            "type": "collection"
        }, {
            ............省略.............
        }]
    },
    "message": "OK"
}

2.1点击第一个banner

接口:
http://maimenghuo.com/v2/collections/72/posts?gender=1&generation=1&limit=20&offset=0
JSON数据
posts:[{}] 里是点击后推送的页面的信息,合计5个(posts_count)

{
    "code": 200,
    "data": {
        "banner_image_url": "http://7xkwn3.com1.z0.glb.clouddn.com/image/160331/mqi7z1h64.jpg-w300",
        "cover_image_url": "http://7xkwn3.com1.z0.glb.clouddn.com/image/160331/vp0ycx4s6.jpg-w720",
        "created_at": 1459463400,
        "id": 72,
        "paging": {
            "next_url": "http://maimenghuo.com/v2/collections/72/posts?generation=1&gender=1&limit=20&offset=20"
        },
        "posts": [{
            "content_url": "http://www.maimenghuo.com/posts/17980/content",
            "cover_image_url": "http://7xkwn3.com1.z0.glb.clouddn.com/image/160326/ippe6sqfc.jpg-w720",
            "created_at": 1459031403,
            "id": 17980,
            "label_ids": [],
            "liked": false,
            "likes_count": 996,
            "published_at": 1459031403,
            "share_msg": " 一年一度的愚人节又来临了,小伙伴们是不是都跃跃欲试,打算整蛊一番呢?萌萌兔紧跟步伐,为大家带来了这些整蛊小道具,请笑纳~",
            "short_title": "整人玩具",
            "status": 0,
            "title": "愚人节|你准备好整蛊了吗?",
            "updated_at": 1458555028,
            "url": "http://www.maimenghuo.com/posts/17980"
        }, {
            .....第二个.....
        }, {
            .....第三个.....
        }, {
            .....第四个.....
        }, {
            .....第五个.....
        }],
        "posts_count": 5,
        "status": 0,
        "subtitle": "整蛊无罪 愚人有理",
        "title": "愚人节快乐!",
        "updated_at": 1459413920
    },
    "message": "OK"
}

2.2 banner各图片推送的接口

点击第二个banner图片接口是:
http://maimenghuo.com/v2/collections/71/posts?gender=1&generation=1&limit=20&offset=0

所以banner的各张图片的接口是:

[NSString stringWithFormat:@"http://maimenghuo.com/v2/collections/%@/posts?gender=1&generation=1&limit=20&offset=0",banner.target_id];

3.中间四个小按钮

显示接口是:
http://maimenghuo.com/v2/promotions?gender=1&generation=1
JSON数据

{
  "code": 200, 
  "data": {
    "promotions": [
      {
        "color": "#ff6d3b", 
        "icon_url": "http://7xkwn3.com1.z0.glb.clouddn.com/image/160116/f39eb72.png-pw144", 
        "id": 1, 
        "order": null, 
        "status": 0, 
        "target_url": "maimenghuo:///page?type=topic&topic_id=14&page_action=navigation&title=%08%e6%af%8f%e6%97%a5%e5%8d%81%e4%bb%b6", 
        "title": "每日十件"
      }, {
        .....第二个.....
      }, {
        .....第三个.....
      }, {
        .....第四个.....
   } ]
  }, 
  "message": "OK"
}

3.1 按钮接口

第一按钮,接口是
http://maimenghuo.com/v2/collections/14/posts?gender=1&generation=1&limit=20&offset=0
第二按钮,接口是
http://maimenghuo.com/v2/collections/15/posts?gender=1&generation=1&limit=20&offset=0

从上面的JSON里的target_url 可以看出有topic_id/navigation&title等
所以对应按钮的接口是

[NSString stringWithFormat:@"http://maimenghuo.com/v2/collections/%@/posts?gender=1&generation=1&limit=20&offset=0",promotions.topic_id];

4.下面的tableview

下面的tableview ,tableview的接口就是教程上一节分析的:
http://maimenghuo.com/v2/channels/22/items?gender=1&generation=1&limit=20&offset=0

[NSString stringWithFormat:@"http://maimenghuo.com/v2/channels/%@/items?gender=1&generation=1&limit=20&offset=0",NavTab.Id];

恩.这个教程会慢慢更新,零基础入门型选手应该都能看得懂.

转载请注明出处.谢谢.

上一篇下一篇

猜你喜欢

热点阅读