Download the PHP package pyrsmk/streams without Composer
On this page you can find all versions of the php package pyrsmk/streams. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package streams
Streams 1.2.0
Streams aims to unify several social feeds with the same API. It is heavily based on Guzzle and async requests.
This library is part of the Myriade 2 project (link coming soon).
It currently supports :
- DeviantArt
- Dribbble
- 500px
- Flickr
- Google Plus
- Vimeo
- Youtube
Install
A quick example
Let's see how we can get 50 photos from a National Geographic album on Facebook :
Notes
The several supported APIs don't support pagination similarly. While pagination is completely transparent in Streams, if we don't set a limit in the stream parameters, the stream will try to get all the possible elements. Often, the stream is unable to get all existing elements, because the corresponding API forbids it (the pagination is incomplete). But some streams have an infinite pagination (they get all existing elements), and the request can take a really long time, even throw a memory exceeded exception from PHP (our tests showed us that PHP crashes around 10000 retrieved elements).
Types
Each element can be of 4 different types : text
, image
, video
and embed
. Embed can be an embedded video, or any other HTML code that an API can return.
Here's the data returned by each type of element.
Text
Image
Video
Embed
Notes
- mime types are retrieved automatically by Streams; it creates many additional requests but since they're run all at once aynschronously, the footprint is trivial
Streams
Here's the list of the available streams and their respective options.
Options
Streams have some base options :
nsfw
:true
to retrieve NSFW elements (default :false
)limit
: a number of elements to get (default :false
)select
: list the element types to get (default :['text', 'image', 'video', 'embed']
)
Streams can have several additional options, according to the respective API. They often need an api
and secret
options fulfilled. These options are usually the client_id
and client_secret
after the creation of an application on the remote website.
File system
Notes
- support image and video types
- do not support video previews
- do not support permalinks
- do not support NSFW
- do not support author and avatar
- do not support description
DeviantArt
Get images from a category (the ID of a category is visible in the URI of the corresponding page on DeviantArt) :
Get root images on a gallery of a user (other specific galleries are not supported) :
Notes
The DeviantArt API is not really mature. We had pretty bad times with it, and as far as we can tell, there're many things that don't work because of design problems on the API (and some other weird things).
- support texts and images
- impossible to get the description for an image
- impossible to get videos
- impossible to get a specific gallery (https://stackoverflow.com/questions/28581350/obtain-deviantart-deviation-id-from-page-url)
- sometimes requests can be really slow
Dribbble
Get images from a bucket :
Get images from a project :
Get images from a team :
Get images from a user :
Notes
- support images
- do not support NSFW
Get images from an album on a page :
Get profile photos from a page :
Get root (uploaded) photos from a page :
Get videos from a page :
Get notes (articles) from a page :
Notes
- support image and embed types
- there's no description on images
- notes cannot return a date
- do not support NSFW
500px
Get images from a user :
Get images from a user's gallery :
Notes
- support images
Flickr
Get medias from a user :
Get medias from a user's album :
- support image and embed types
Notes
- cannot get NSFW pictures, because they are not public
Google Plus
Get medias from people :
Notes
- support text, image and embed types
- infinite pagination
- do not support NSFW
Get last images from a user :
Notes
- support image and video types
- since 2016 June, it is impossible communicate with the API without authentifying the user; since Streams lies on public access (because we DO NOT want to display OAuth confirmations to the final user), we just can get the 20 last posts of an Instagram account
- do not support NSFW
Get medias from a subreddit :
Get medias from user's posts :
Notes
- support text, image and embed types
- the API can be a bit slow
Vimeo
Get videos from a category :
Get videos from a channel :
Get videos from a group :
Get videos from a user :
Notes
- support embed type
Youtube
Get videos from a channel :
Get videos from a playlist :
Notes
- support embed type
- do not support NSFW
Group requests
If you want to get several streams at once (and because it's more effective), you can use the Guzzle Pool class :
For more reading on concurrent requests with Guzzle, please read the documentation.
License
MIT.
All versions of streams with dependencies
facebook/graph-sdk Version ^5.4
james-heinrich/getid3 Version ^1.9
symfony/dom-crawler Version ^3.2
symfony/css-selector Version ^3.2