af_redditimgur: support video elements in imgur albums
This commit is contained in:
parent
64c24ecb59
commit
a6fde6c99f
|
@ -239,7 +239,7 @@ class Af_RedditImgur extends Plugin {
|
||||||
|
|
||||||
//if ($debug) print_r($album_content);
|
//if ($debug) print_r($album_content);
|
||||||
|
|
||||||
$aentries = $axpath->query("(//div[@class='post-image']/img[@src] | //a[@class='zoom']/img[@src])");
|
$aentries = $axpath->query("(//div[@class='post-image']/img[@src] | //a[@class='zoom']/img[@src] | //div[@class='video-elements']/source)");
|
||||||
$urls = [];
|
$urls = [];
|
||||||
|
|
||||||
foreach ($aentries as $aentry) {
|
foreach ($aentries as $aentry) {
|
||||||
|
@ -247,6 +247,9 @@ class Af_RedditImgur extends Plugin {
|
||||||
$url = $aentry->getAttribute("src");
|
$url = $aentry->getAttribute("src");
|
||||||
|
|
||||||
if (!in_array($url, $urls)) {
|
if (!in_array($url, $urls)) {
|
||||||
|
|
||||||
|
if ($aentry->tagName == "img") {
|
||||||
|
|
||||||
$img = $doc->createElement('img');
|
$img = $doc->createElement('img');
|
||||||
$img->setAttribute("src", $url);
|
$img->setAttribute("src", $url);
|
||||||
$entry->parentNode->insertBefore($doc->createElement('br'), $entry);
|
$entry->parentNode->insertBefore($doc->createElement('br'), $entry);
|
||||||
|
@ -255,6 +258,16 @@ class Af_RedditImgur extends Plugin {
|
||||||
|
|
||||||
$entry->parentNode->insertBefore($img, $entry);
|
$entry->parentNode->insertBefore($img, $entry);
|
||||||
$entry->parentNode->insertBefore($br, $entry);
|
$entry->parentNode->insertBefore($br, $entry);
|
||||||
|
} else if ($aentry->tagName == "source") {
|
||||||
|
|
||||||
|
if (strpos($url, "i.imgur.com") !== FALSE)
|
||||||
|
$poster_url = str_replace(".mp4", "h.jpg", $url);
|
||||||
|
else
|
||||||
|
$poster_url = "";
|
||||||
|
|
||||||
|
$this->handle_as_video($doc, $entry, $url, $poster_url);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
array_push($urls, $url);
|
array_push($urls, $url);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue