闲鱼爬虫源码淘宝闲鱼商品爬虫源码

闲鱼爬虫源码淘宝闲鱼商品爬虫源码,可以爬取闲鱼商品的商品内容,图片,价格,出售人信息等等

运行本程序之后可以抓取手机闲鱼App中的商品数据,可以随意按照自定义的关键词抓取自己想要的商品数据。包含商品的详细信息,抓取入库了。可自行筛选符合自己要求的商品数据,方便快捷精准买到性价比高的二手商品。

爬到的数据样例:

[
    {
        "title":"大疆Mavic Air2畅飞套装,带换新,截止日期6月3号, 机器去年6月多购买,如图所示,所有配件全在,盒子扔了,有收纳包,自己又单独买了图二配件,包括增高架,抛投器,平板支架,机器完美无划痕,可以看我录的视频,遥控器也是完 美无划痕,电池循环次数如图所示,不议价不议价不议价,这个价格懂得都懂,所有信...",
        "area":"北京",
        "itemId":"642422473526",
        "picUrl":"http://img.alicdn.com/bao/uploaded/i4/O1CN011bIER51lP1kbfmtQ2_!!0-fleamarket.jpg",
        "oriPrice":"",
        "tagname":"极好/2人想要",
        "soldPrice":"5280",
        "userNick":"绣巷属新鲜的木瓜",
        "itemType":"detailCommonBuy"
    },
    {
        "title":"大疆御air1,全新机身加一块全新电池,个人闲置,昨天换新, 外加3块正常工作电池,一共4块电池,电池管家一套,机翼 叶片副厂两套,原厂两套,保护罩一套未拍上。现低价出售,功能一切正常,全新机器。不刀不刀,看到即是实价,讲价者勿扰。买到就是赚到。售出无质量问题不退不换。运费到付,当天确认收货退回运费。",
        "area":"山东",
        "itemId":"643106979306",
        "picUrl":"http://img.alicdn.com/bao/uploaded/i4/O1CN01OV1xCv1R3EaZkzWXJ_!!0-fleamarket.jpg",
        "oriPrice":"",
        "tagname":"极好/7人想要",
        "soldPrice":"3560",
        "userNick":"RuiSeptember",
        "itemType":"detailCommonBuy"
    }
]

  

数据简单应用效果:做成自己的网页,按自己的条件重新搜索数据。标注描述中的关键字,按价格最低排序,很容易就能找到自己想要的商品。直接从网页上点击跳转到闲鱼App打开详情页

数据测试地址:http://stock.changu.net/xianyu/vue

 

核心hook代码

闲鱼商品搜索接口:
{"apiName":"mtop.taobao.idle.search.glue","apiVersion":"8.0","needJsonReq":false,"needLogin":false,"needWua":false}
请求参数:
{
    "activeSearch":false,
    "bizFrom":"home",
    "forceUseInputKeyword":false,
    "forceUseTppRepair":false,
    "fromFilter":false,
    "fromKits":false,
    "fromLeaf":false,
    "fromShade":false,
    "fromSuggest":false,
    "gps":"39.925586,116.194936",
    "keyword":"你的搜索关键词",
    "latitude":"39.925586",
    "longitude":"116.194936",
    "pageNumber":1,
    "resultListLastIndex":0,
    "rowsPerPage":10,
    "searchReqFromActivatePagePart":"searchButton",
    "searchReqFromPage":"xyHome",
    "searchTabType":"SEARCH_TAB_MAIN",
    "searchType":"common",
    "shadeBucketNum":1,
    "suggestBucketNum":-1
}

  返回结果

{
    "data":{
        "item":{
            "main":{
                "clickParam":{
                    "arg1":"Item",
                    "args":{
                        "biz_type":"item",
                        "bucketid":"21",
                        "cCatId":"126856567",
                        "card_type":"idlefish_search_card_item_waterfall",
                        "catId":"50023914",
                        "id":"642417625236",
                        "index":"2",
                        "item_id":"642417625236",
                        "item_type":"goods",
                        "labelBucketId":"3",
                        "page":"7",
                        "pageSize":"10",
                        "position":"78",
                        "q":"%E5%A4%A7%E7%96%86air2",
                        "rn":"b9422f7d85c2674cfca17c4bbe82b2ad",
                        "search_from_page":"xyHome",
                        "search_id":"6235ddeb301fb829c4d99c1e028d88b0",
                        "spm":"a2170.8011571.1.78",
                        "tag":"wantnum-9",
                        "tagname":"9人想要",
                        "tbCatId":"125166009",
                        "type":"1",
                        "unShowLabelParams":"{"36":"轻微使用痕迹","38":"DJI/大疆","41":"¥7407"}",
                        "wantNum":"9"
                    },
                    "bizType":"item",
                    "page":"Page_xySearchResult"
                },
                "exContent":{
                    "area":"浙江",
                    "detailParams":{
                        "isVideo":"false",
                        "itemId":"642417625236",
                        "itemType":"detailCommonBuy",
                        "picHeight":"1920",
                        "picWidth":"1080",
                        "soldPrice":"5300",
                        "title":"2月份购买的大疆御air2无人机随心换加畅飞套装。九成新,三 块电池均循环二十次左右。地点在浙江义乌,有同城者线下见面交易。",
                        "userNick":"宁小城踢足球",
                        "want":"9人想要"
                    },
                    "isAliMaMaAD":"false",
                    "isAuction":"false",
                    "itemId":"642417625236",
                    "oriPrice":"¥7407",
                    "picHeight":"218.66666666666666",
                    "picUrl":"http://img.alicdn.com/bao/uploaded/i3/O1CN01gdnVB41n2FHTKtspd_!!0-fleamarket.jpg",
                    "picWidth":"164.0",
                    "placeholderColor":"#F7F7F7",
                    "price":[
                        {
                            "bold":"true",
                            "marginBottom":"4",
                            "text":"¥",
                            "textColor":"#ff4444",
                            "textSize":"12.0"
                        },
                        {
                            "bold":"true",
                            "marginBottom":"2",
                            "text":"5300",
                            "textColor":"#ff4444",
                            "textSize":"18.0"
                        }
                    ],
                    "priceTag":[
                        {
                            "data":{
                                "fontWeight":"w400",
                                "lineHeight":"1.6",
                                "text":"9人想要",
                                "textColor":"#FFA3A3A3",
                                "textSize":"10.0"
                            },
                            "type":"Text"
                        }
                    ],
                    "richTitle":[
                        {
                            "data":{
                                "fontWeight":"w700",
                                "lineHeight":"1.3571428571428572",
                                "text":"2月份购买的大疆御air2无人机随心换 加畅飞套装。九成新,三 块电池均循环二十次左右。地点在浙江义乌,有同城者线下见面交易。",
                                "textColor":"#FF333333",
                                "textSize":"14.0"
                            },
                            "type":"Text"
                        }
                    ],
                    "showVideoIcon":"false",
                    "stuffStatusTagHeight":"0.0",
                    "stuffStatusTagWidth":"0.0",
                    "title":"2月份购买的大疆御air2无人机随心换加畅飞套装。九成新,三 块电池均循环二十次左右。地点在浙江义乌,有同城者线下见面交易。",
                    "userActiveUrl":"https://gw.alicdn.com/tfs/TB1zIymVUz1gK0jSZLeXXb9kVXa-30-30.png",
                    "userAvatarUrl":"http://img.alicdn.com/sns_logo/i1/O1CN01UZiot91n2FHGxgaOU_!!0-fleamarket.jpg",
                    "want":"9人想要"
                },
                "targetUrl":"fleamarket://awesome_detail?id=642417625236&flutter=true&referPageArgs=%E5%A4%A7%E7%96%86air2&referPage=Page_xySearchResult&trackParamsJson=%7B%22q%22%3A%22%25E5%25A4%25A7%25E7%2596%2586air2%22%2C%22page_number%22%3A%227%22%2C%22item_id%22%3A%22642417625236%22%2C%22item_type%22%3A%22goods%22%2C%22index%22%3A%222%22%2C%22id%22%3A%22642417625236%22%2C%22rn%22%3A%22b9422f7d85c2674cfca17c4bbe82b2ad%22%2C%22search_from_page%22%3A%22xyHome%22%2C%22search_id%22%3A%226235ddeb301fb829c4d99c1e028d88b0%22%7D"
            }
        },
        "template":{
            "name":"idlefish_search_card_item_waterfall",
            "url":"https://ossgw.alicdn.com/rapid-oss-bucket/1615185324004/idlefish_search_card_item_waterfall.zip",
            "version":"6"
        }
    },
    "style":"flow",
    "type":"DX"
}

  

闲鱼商品详情页:
https://market.m.taobao.com/app/idleFish-F2e/widle-taobao-rax/page-detail?id=626382089218
详情页请求参数:
{"gps":"39.925575,116.194931","itemId":"626382089218","latitude":"39.925575","longitude":"116.194931","needSimpleDetail":false},[request]:{"apiName":"mtop.taobao.idle.awesome.detail","apiVersioin":"1.0","gps":"39.925575,116.194931","mParam":{"gps":"39.925575,116.194931","itemId":"626382089218","latitude":"39.925575","longitude":"116.194931","needSimpleDetail":false},"mRequestConfig":{"apiName":"mtop.taobao.idle.awesome.detail","apiVersion":"1.0","needJsonReq":false,"needLogin":false,"needWua":false},"originJson":false,"param":{"gps":"39.925575,116.194931","itemId":"626382089218","latitude":"39.925575","longitude":"116.194931","needSimpleDetail":false},"requestConfig":{"apiName":"mtop.taobao.idle.awesome.detail","apiVersion":"1.0","needJsonReq":false,"needLogin":false,"needWua":false},"secondRefresh":false,"startTime":1618059082660}'}

package com.taobao.idlefish.protocol.net;

import com.taobao.idlefish.protocol.Protocol;
import com.taobao.idlefish.protocol.net.api.BaseApiProtocol;

public interface PApiContext extends Protocol {
    long getDate();

    void logout();

    <T, A extends ResponseParameter> void send(BaseApiProtocol<T, A> baseApiProtocol, ApiCallBack<A> apiCallBack);
}
--------------------------------------------------------------------------------
public void ss() {
    Log.c("detail", "jinyi.cyp80", "begin recommendForPreload....");
    if (this.mItemDetailDO == null || ((this.eN != null && this.eN.size() > 0) || !this.mItemDetailDO.needRecommand)) {
        Log.c("detail", "jinyi.cyp80", "return recommendForPreload....");
        return;
    }
    ((PApiContext) XModuleCenter.moduleForProtocol(PApiContext.class)).send(new ApiProtocol().apiNameAndVersion("mtop.taobao.idle.item.recommend.list", "2.0").paramMap(JSON.parseObject(JSON.toJSONString(a(this.mItemDetailDO)))), new ApiCallBack<ResponseParameter>() {
        /* class com.taobao.fleamarket.detail.model.ItemDetailModel.AnonymousClass3 */

        @Override // com.taobao.idlefish.protocol.net.ApiCallBack
        public void onSuccess(ResponseParameter responseParameter) {
            if (responseParameter.getData() != null) {
                JSONArray cardList = ((JSONObject) responseParameter.getData()).getJSONArray("cardList");
                if ((responseParameter.getData() instanceof JSONObject) && cardList != null) {
                    ResponseParameter unused = ItemDetailModel.this.a = responseParameter;
                    Log.c("detail", "jinyi.cyp80", "get prelaodData!!");
                }
            }
        }

        @Override // com.taobao.idlefish.protocol.net.ApiCallBack
        public void onFailed(String code, String msg) {
            Log.c("detail", "jinyi.cyp80", "failed prelaodData!!");
        }
    });
}