• PHP 通过APP包名爬取goole商店素材


     

    一, 实验目的:通过APP 包名爬取goole商店素材

     

    二, 前期准备

      1, 能FQ、一个合法的包名。

      2, 我们需要一个php html解析工具,这里我选择的是GitHub上的一个包,在你里项目composer.json中添加 "require": {"bupt1987/html-parser": "dev-master"}, 然后composer install就可以安装了。 

         https://github.com/daorli/HtmlDomFilter这是GitHub地址,更多的使用方法请查看。觉得好用别忘了给人家一个star。

     

     三, 实验开始

      //首先我们建立一个入口函数  传递一个包名。 这里以微信为例(微信团队看到了,请给我点推广费哦)!

    public function getGoolePaly($package_name='com.tencent.mm'){
    $url = 'https://play.google.com/store/apps/details?id=' . $package_name; //拼接一个有效的goole store play地址
    $html = creativeGet($url); //creativeGet这个函数请见我的上一篇文章 https://www.cnblogs.com/onlyzc/p/9519330.html 中。
        $dom = new HtmlParserParserDom($html); //这个就是composer 安装的包 传入HTML dom
    $info = [];
    $info['app_name'] = $dom->find('h1[itemprop="name"]',0)->getPlainText(); //APP name 找到属性 itemprop="name" 的H1的内容

    $info['des'] = $dom->find('[itemprop="description"]',0)->getAttr('content'); //类似上述 获取 App description
        $info['icon'] = $dom->find('img[itemprop="image"]',0)->getAttr('src'); //类似上述 获取 App icon的下载链接

    $type = $dom->find('a[itemprop="genre"]',0)->getAttr('href'); //获取App 的分类
      $type = explode('/',$type);
      $info['category'] = end($type);
        $creative = $dom->find('[data-screenshot-item-index] img'); //获取App 的素材
    $info['screenshot'] = [];
    foreach($creative as $item){
    $info['screenshot'][]=["url"=>$item->getAttr('src')];
    }
    response()->json($info);

    }

    写在最后,以上就是PHP 通过一个包名获取goole store paly素材的操作,如果想拿到更多的信息,可以观察goole store paly某一个App页面得出。

    *转载请务必注明来源
  • 相关阅读:
    支付宝移动支付开发详细教程服务端采用.net mvc webapi(C#)
    微信移动支付V3开发详细教程服务端采用.net mvc webapi(C#)
    CSS border-radius 圆角
    CSS hack大全&详解(什么是CSS hack)
    一小时搞定DIV+CSS布局-固定页面开度布局
    ASP.NET MVC3开发
    .net mvc页面UI之Jquery博客日历控件
    ASP.NET MVC3开发-数据库篇之CodeFisrt开发(一)
    ASP.NET MVC页面UI之联动下拉选择控件(省、市、县联动选择)
    Jquery文本框值改变事件(支持火狐、ie)
  • 原文地址:https://www.cnblogs.com/onlyzc/p/9550060.html
Copyright © 2020-2023  润新知