淘宝App直播宝贝数据采集

淘宝App直播宝贝数据采集
 

  前段时间,有人问我关于淘宝app直播频道宝贝如何采集?我尝试了下可以获取的到,模拟器登录不了淘宝,这里有一个坑就是,模拟器有时候会跳到登录页面,登录不了淘宝;

 

一、用Android的SDK目录下自带的uiautomatorviewer工具,可以获取到app当前界面源代码,拿其中一部分代码来分析下:

淘宝App直播宝贝数据采集_第1张图片

 


.........................................................

 

属性分析:

index 索引

text 文本内容

content-desc 文本描述

resource-id 控件的id

class 控件的类名

package 包名

checkable 是否可选中

checked 是否选中

clickable 是否可点击

enabled 是否可用

focusable 是否可设置焦点

focused 是否焦点

scrollable 是否可滚动  

long-clickable 是否可长按

password 是否密码类型

selected 是否选中

bounds 矩形区域

 

通过text或者content-desc可以得到app中显示的文字内容!

 

 

二、下面是采集的数据截图:

第一步:打开淘宝app,找到中间位置 淘宝直播,获取分类的数据

淘宝App直播宝贝数据采集_第2张图片

 




第二步:获取淘宝直播ID昵称

淘宝App直播宝贝数据采集_第3张图片
 

 

 

第三步:获取直播在售的宝贝数据

淘宝App直播宝贝数据采集_第4张图片

 

 

 三、将手机app的界面截图显示在桌面,主要就是用GDI绘图!

关键代码:

Procedure DoPaintImg(DC: HDC; pic : string;h,w:Integer);
var
graphics : TGPGraphics;
Image: TGPImage;
destinationPoints : array[0..2] of TGPPoint ;
begin
destinationPoints[0].X := 0;
destinationPoints[0].Y := 0;
destinationPoints[1].X := h;
destinationPoints[1].Y := 0;
destinationPoints[2].X := 0;
destinationPoints[2].Y := w;
graphics := TGPGraphics.Create(DC);
Image:= TGPImage.Create(pic);

graphics.DrawImage(image, PGPPoint(@destinationPoints), 3);

Image.Free;
graphics.Free;

end;

 

你可能感兴趣的:(淘宝App直播宝贝数据采集)