feat: Append video description
This commit is contained in:
parent
6fb9ee7c38
commit
735917119f
9
init.php
9
init.php
@ -22,6 +22,7 @@ class YFrames extends Plugin {
|
||||
|
||||
function hook_article_filter($article) {
|
||||
|
||||
// $debug = json_encode($article);
|
||||
// Match allowed links and extract "video ID"
|
||||
if (preg_match_all("/.*(youtube|youtu)\.(com|be)\/watch\?v=([\w\d_-]+).*/i",
|
||||
$article["link"], $matches, PREG_PATTERN_ORDER)) {
|
||||
@ -35,7 +36,13 @@ class YFrames extends Plugin {
|
||||
}
|
||||
}
|
||||
|
||||
$article["content"] .= "<br/>" . $link;
|
||||
$description = str_replace("\n", "<br/>", $article["enclosures"][0][3]);
|
||||
if (strlen($description) > 0) {
|
||||
$article["content"] .= "<br/>" . $description ;
|
||||
} else {
|
||||
$article["content"] .= "<br/>No video description available.";
|
||||
}
|
||||
|
||||
return $article;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user