actually download <video> posters to media cache

video[@poster] is already supported in the rewriting logic but never
actually downloaded
This commit is contained in:
lllusion3418 2020-03-12 11:08:33 +01:00
parent b4287a2e98
commit cdde23b4dc
1 changed files with 20 additions and 18 deletions

View File

@ -1229,11 +1229,12 @@ class RSSUtils {
if ($doc->loadHTML($html)) {
$xpath = new DOMXPath($doc);
$entries = $xpath->query('(//img[@src])|(//video/source[@src])|(//audio/source[@src])');
$entries = $xpath->query('(//img[@src])|(//video/source[@src])|(//audio/source[@src])|(//video[@poster])');
foreach ($entries as $entry) {
if ($entry->hasAttribute('src') && strpos($entry->getAttribute('src'), "data:") !== 0) {
$src = rewrite_relative_url($site_url, $entry->getAttribute('src'));
foreach (array('src', 'poster') as $attr) {
if ($entry->hasAttribute($attr) && strpos($entry->getAttribute($attr), "data:") !== 0) {
$src = rewrite_relative_url($site_url, $entry->getAttribute($attr));
$local_filename = sha1($src);
@ -1262,6 +1263,7 @@ class RSSUtils {
}
}
}
}
static function expire_error_log() {
Debug::log("Removing old error log entries...");