1
0
Fork 0
forked from blallo/rss-bridge

[Youtube] Use metatag for publishdate (fix issue #132)

This commit is contained in:
Mitsukarenai 2015-05-31 00:16:42 +02:00
parent 75585e7b52
commit 54c5e9f5ea

View file

@ -24,11 +24,10 @@ class YoutubeBridge extends BridgeAbstract{
public function collectData(array $param){
function getPublishDate($id) {
// relies on Youtube API; deprecated
$json = json_decode(file_get_contents("https://gdata.youtube.com/feeds/api/videos/$id?v=2&alt=json"), TRUE);
$timestamp = strtotime($json['entry']['published']['$t']);
$html2 = file_get_html("https://www.youtube.com/watch?v=$id");
$timestamp = strtotime($html2->find('meta[itemprop=datePublished]', 0)->getAttribute('content') );
return $timestamp;
}
}
$html = '';