mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-25 19:01:18 +02:00
[Youtube] Use metatag for publishdate (fix issue #132)
This commit is contained in:
@@ -24,11 +24,10 @@ class YoutubeBridge extends BridgeAbstract{
|
|||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
|
|
||||||
function getPublishDate($id) {
|
function getPublishDate($id) {
|
||||||
// relies on Youtube API; deprecated
|
$html2 = file_get_html("https://www.youtube.com/watch?v=$id");
|
||||||
$json = json_decode(file_get_contents("https://gdata.youtube.com/feeds/api/videos/$id?v=2&alt=json"), TRUE);
|
$timestamp = strtotime($html2->find('meta[itemprop=datePublished]', 0)->getAttribute('content') );
|
||||||
$timestamp = strtotime($json['entry']['published']['$t']);
|
|
||||||
return $timestamp;
|
return $timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$html = '';
|
$html = '';
|
||||||
|
Reference in New Issue
Block a user