一、如何采集拼多多店铺数据呢?
拼多多如今已经成为继淘宝、京东之后的第三大电商平台,最近两年也是火的不行,很多的客户需求会提到拼多多这个电商平台,首先要知道拼多多大部分商品都是在手机端的,PC电脑端展示的商品数据很少,我们采集一个店铺的 数据,首先找到这个店铺的ID!
1.例如我们打开手机拼多多APP,搜索关键词"飞科剃须刀",随便点击一个宝贝,进入这个店铺,我们就以推荐的这个店铺为例,点击进入店铺
2.下面可以看到整个店铺的页面,点击右上角的分享,分享给自己
3.在电脑端打开微信,在文件传输助手中打开链接
4.点击链接打开,如下图所示,可以看到有个“复制链接地址”,点击复制;
5.在自带浏览器,粘贴网址,并按回车,即可看到店铺的ID。
二、根据拼多多店铺ID采集整个店铺的链接等数据
1.通过http协议爬取店铺的链接,得到的关键数据如下:
1359867484" class="double-grid-one-v3 "><div class="double-grid-item-v3 dgo-gap-right"><div class="std-goods-image-square"><img data-url="//t00img.yangkeduo.com/goods/images/2018-10-20/ad21880eacd884ecdab73748c732011d.jpeg?imageMogr2/format/webp/quality/50" data-index="0"></div><div class="detail"><div class="name-block"><p class="goods-name">飞科专卖店正品毛球修剪器充电式去球器衣服吸刮除毛器起脱打毛器</p></div><div class="core"><div class="info"><p class="sale-price"><i>¥</i>19.9</p><p class="sold-quantity">已拼7.9万件</p></div><div class="local-groups"><span></span><div class="avatar"><img data-param="70_!_t_!_!_50_!_!_!" src="//t20img.yangkeduo.com/a/1b5aa1cf933bbc94a82451cdb4b66a94df58cdc6-1536914430?imageMogr2/sharpen/1%7CimageView2/2/w/1300/q/70/format/webp"></div><div class="avatar"><img data-param="70_!_t_!_!_50_!_!_!" src="//t20img.yangkeduo.com/a/c8c4c58c724e9e7f40bae71672c1e2234806adbc-1534060783?imageMogr2/sharpen/1%7CimageView2/2/w/1300/q/70/format/webp"></div></div></div></div></div></div><div id="mp-mgl-0-0-0-g-1335648307" class="double-grid-one-v3 "><div class="double-grid-item-v3 dgo-gap-left"><div class="std-goods-image-square"><img data-url="//t00img.yangkeduo.com/goods/images/2018-11-19/3314f991990e1d78e52f885b40eb4426.jpeg?imageMogr2/format/webp/quality/50" data-index="1"></div><div class="detail"><div class="name-block"><p class="goods-name">飞科专卖店正品全身水洗电动剃须刀男士三刀头刮胡刀充电式胡须刀</p></div><div class="core"><div class="info"><p class="sale-price"><i>¥</i>99</p><p class="sold-quantity">已拼1.7万件</p></div><div class="local-groups"><span></span><div class="avatar"><img data-param="70_!_t_!_!_50_!_!_!" src="//t20img.yangkeduo.com/a/be953acaf1df467a1084a41c7d0659efedd4f617-1541327308?imageMogr2/sharpen/1%7CimageView2/2/w/1300/q/70/format/webp"></div><div class="avatar"><img data-param="70_!_t_!_!_50_!_!_!" src="//t20img.yangkeduo.com/a/ac0165194fc62ab0cb79a152199e76a306bea3f3-1541748956?imageMogr2/sharpen/1%7CimageView2/2/w/1300/q/70/format/webp"></div></div></div></div></div></div><div id="mp-mgl-0-0-0-g-1335554793" class="double-grid-one-v3 "><div class="double-grid-item-v3 dgo-gap-right"><div class="std-goods-image-square"><img data-url="//t00img.yangkeduo.com/goods/images/2018-10-20/9aed8d4e6a66bd9696e450a622190f19.jpeg?imageMogr2/format/webp/quality/50" data-index="2" src="//t00img.yangkeduo.com/goods/images/2018-10-20/9aed8d4e6a66bd9696e450a622190f19.jpeg?imageMogr2/format/webp/quality/50"></div><div class="detail"><div class="name-block"><p class="goods-name">飞科专卖店正品全身水洗剃须刀双刀头电动刮胡刀男士充电式胡须刀</p></div><div class="core"><div class="info"><p class="sale-price"><i>¥</i>64.8</p><p class="sold-quantity">已拼2.4万件</p></div>
2.解析抓取到的数据,for循环获取所有宝贝数据
while AnsiPos(str_recycle,s)>0 do
begin
str_td := CopyStr(s,str_recycle,str_recycle,true);
s := DeleteToStr(s,str_recycle,True);
if str_td='' then break;
str_page := IntToStr((i-1) div 10 + 1);
if i mod 10 > 0 then
str_order := str_page+'页'+inttostr(i mod 10)+'位'
else
str_order := str_page+'页10位';
str_itemid := CopyStr(str_td,str_recycle,'"',false);
str_itemurl := Format('http://%s=%s&refer_page_name=search_result', [str_mainurl, str_itemid]);
str_title := CopyStrEx(str_td,'class="goods-name"','>','<',false);
str_price := CopyStr(str_td, '<i>¥</i>', '<',False);
str_paycount := CopyStrEx(str_td,'class="sold-quantity','>','<',False);
str_type := '拼多多店';
inc(i);
if not CheckPrice(str_price, str_priceSJ) then
Continue;
//do something........................
end;
3.获取的数据如下图所示:
即可看到第一位的数据和截取的数据完全一直,其他的数据都可以依次获取到! 发帖不易,如果对您有帮助,记得给我点赞哦(⊙o⊙)