Coder Social home page Coder Social logo

open-source-contributions / video-platforms-parser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chojnicki/video-platforms-parser

0.0 1.0 0.0 29 KB

Easy to use grabber for video info, screens and more from YouTube and other platforms.

PHP 100.00%

video-platforms-parser's Introduction

Video Platforms Parser

Video Platforms Parser is easy to use SDK with grabber for multiple platforms at once, like YouTube, Dailymotion, Facebook and more.

Requirements

  • PHP 7.0 or higher
  • Laravel 5.4 or higher (not tested on lower but should work on 5.*)

Supported platforms

Platform With API Without API
YouTube YES (key required) YES
Dailymotion YES YES
Facebook (not ready) YES
LiveLeak NO API YES
CDA NO API YES
Vimeo YES YES
Streamable YES YES
  • With API - parser is using official API (default) - fast and reliable (but YouTube require api key)
  • Without API - parser will grab video page and parse required info (needed in platforms that do not provide API or as a backup) - can be slower and less reliable

Every parser that is using API also has parser without API as backup. To use it you need to disable API for selected platform in config (not recommended).

Installation with Composer

Simply require package with composer:

composer require chojnicki/video-platforms-parser

Installation without Composer or Laravel

Download zip of this repository and unpack in your PHP project. Require VideoPlatformsParser file:

require '/video-platforms-parser/src/VideoPlatformsParser.php';

Usage with Laravel

Require package with composer:

composer require chojnicki/video-platforms-parser

(for Laravel below 5.5) In /config/app.php add Service Provider:

Chojnicki\VideoPlatformsParser\ServiceProvider::class,

(for Laravel below 5.5) In /config/app.php add Facade:

'VideoPlatformsParser' => Chojnicki\VideoPlatformsParser\Facade::class,

Publish config:

php artisan vendor:publish --provider="Chojnicki\VideoPlatformsParser\ServiceProvider"

Now You can start grabbing info like this:

$info = VideoPlatformsParser::get('https://www.youtube.com/watch?v=jofNR_WkoCE');

Usage without Laravel but with Composer

Require Composer to project if it was not required before

require_once 'vendor/autoload.php';

Create new object:

$parser = new Chojnicki\VideoPlatformsParser\VideoPlatformsParser(); // put array config inside

Grab video info like this:

$info = $parser->get('https://www.youtube.com/watch?v=jofNR_WkoCE');

Usage without Laravel and without Composer

Require parser

require '/video-platforms-parser/src/VideoPlatformsParser.php';

Manually load parsers for every video platform that will be used

require '/video-platforms-parser/src/parsers/YouTube.php';

Create new object:

$parser = new Chojnicki\VideoPlatformsParser\VideoPlatformsParser(); // put array config inside

Grab video info like this:

$info = $parser->get('https://www.youtube.com/watch?v=jofNR_WkoCE');

Returned data

For every supported platform parser will return array with:

  • id: video ID
  • platform: site name
  • title: video title
  • description: video description
  • thumbnail: url for image with highest possible resolution
  • tags: array with keywords
  • duration: length in seconds (not supported in LiveLeak and Facebook yet [more info])
  • api: will be true if official platform API was used and false otherwise

Optional config

Config is located in video-platforms-parser.php or you can pass array with VideoPlatformsParser object:

Default config:

[
    'youtube_api_key' => '',
    'youtube_api_disabled' => false,
    'dailymotion_api_disabled' => false,
    'vimeo_api_disabled' => false,
    'streamable_api_disabled' => false
]

video-platforms-parser's People

Contributors

chojnicki avatar cristianvuolo avatar jochensengier avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.