Skip to content

Instantly share code, notes, and snippets.

View ismoil-nosr's full-sized avatar
👁️‍🗨️

Ismoil Nosr ismoil-nosr

👁️‍🗨️
  • Uzbekistan
View GitHub Profile
@ismoil-nosr
ismoil-nosr / parse.php
Last active December 21, 2019 22:55
The script parses youtube channel and gets latest videos
<?php
/*
@Author: https://github.com/divinity76
*/
$channel = 'https://www.youtube.com/user/Tobuscus/videos?view=0&sort=dd&flow=grid'; //link to channel with sort parametrs in url
$maxResults = 3; //max number of videos to parse/output
$html = file_get_contents($channel);
$domd = @DOMDocument::loadHTML($html);
$xp = new DOMXPath($domd);