定制 lefuturiste/google-photos-album-crawler 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lefuturiste/google-photos-album-crawler

Composer 安装命令:

composer require lefuturiste/google-photos-album-crawler

包简介

Google Photos public album crawler/fetcher

README 文档

README

Google photos logo

Latest Stable Version Total Downloads License

PHP Google photos album crawler

Just a little and light script to fetch an album name, images from a public google photos album url. This simple script will simply use guzzle to get the html of the page, apply a regex to get the JSON data, then parse it. For big album it might take a little bit of time so be patient and make sure to not block the main thread of your application. You can for example use this script in a async task or a job queue. Enjoy!

Requirements & dependencies

  • php7.1 or newer
  • ext-curl
  • guzzlehttp/guzzle

Installation

composer require lefuturiste/google-photos-album-crawler

Usage

Be sure to use a public google photos sharing URL with the correct format.

Use the Crawler class inside the right namespace and call the method getAlbum after instantiating the class.

This method return the following format:

  • id: id of the album
  • name: name of the album
  • images[]:
    • id: id of the image
    • url: the base url to download the image
    • width: the max width of the image
    • height: the max height of the image
<?php
require 'vendor/autoload.php';

$url = "https://photos.google.com/share/XXX?key=XXX";

$crawler = new \Lefuturiste\GooglePhotosAlbumCrawler\Crawler();

$album = $crawler->getAlbum($url);

echo "Album: " . $album['id'] . " " . $album['name'] . "\n";
echo "Contain: " . count($album['images']) . " images \n\n";

foreach ($album['images'] as $image) {
    echo "- " . $image['id'] . " " . $image['width'] . "x" . $image['height']  . " " . $image['url'] . "\n";
}

For a simple in a file example see: example.php

Contributing

Any issues of suggetion, this is a open source project so you can use github Issues and PR. Also feel free to contact me if you want a quick answer because I don't notice the github notifications...

统计信息

  • 总下载量: 73
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-08-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固