PHP Classes

PHP YouTube Video Scraper: Get details about videos scraping YouTube pages

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 216 All time: 8,309 This week: 524Up
Version License PHP version Categories
facktube 1.0.0MIT/X Consortium ...5PHP 5, Web services, Video, Parsers
Description 

Author

This class can get details about videos scraping YouTube pages.

It can perform searches about videos in YouTube by sending HTTP requests to YouTube site pages Web servers using given search keywords.

The class retrieves the YouTube search result pages and returns details about the videos that were found like the video id, title, thumbnail, description, channelName, channelID, duration, uploaded, views, badges, etc..

Picture of Miraz Mac
  Performance   Level  
Name: Miraz Mac <contact>
Classes: 14 packages by
Country: Bangladesh Bangladesh
Innovation award
Innovation award
Nominee: 6x

Example

<?php

use MirazMac\FackTube\FackTube;

require
__DIR__ . '/../vendor/autoload.php';

$options = [];
$fack = new FackTube($options);

$pageToken = isset($_GET['page']) ? trim($_GET['page']) : null;
$q = isset($_GET['q']) ? trim($_GET['q']) : 'Honest Trailer';

try {
   
$results = $fack->videos($q, $pageToken);
} catch (\
Exception $e) {
    echo
$e->getMessage();
    exit();
}
?>
<form method="get" action="?">
    <label for="q">Query</label>
    <input type="text" name="q" id="q" value="<?php echo htmlspecialchars($q); ?>">
    <button type="submit">Search</button>
</form>
<?php
foreach ($results['videos'] as $video) {
    echo
$video['title'];
    echo
"<hr/>";
}
echo
"<br><ul>";
foreach (
$results['pages'] as $page) {
    echo
'<li><a href="?page=' . $page['pageToken'] . '&q=' . htmlspecialchars($q) . '">' . $page['label'] . '</a></li>';
}
echo
"</ul>";


  Files folder image Files (6)  
File Role Description
Files folder imagesrc (2 files)
Files folder imageusage (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (6)  /  src  
File Role Description
  Plain text file FackTube.php Class Class source
  Plain text file Helpers.php Class Class source

  Files folder image Files (6)  /  usage  
File Role Description
  Accessible without login Plain text file videos.php Example Example script

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:216
This week:0
All time:8,309
This week:524Up