]>
git.wh0rd.org - tt-rss.git/blob - plugins/af_youtube_embed/init.php
2 class Af_Youtube_Embed
extends Plugin
{
7 "Embed videos in Youtube RSS feeds",
11 function init($host) {
14 $host->add_hook($host::HOOK_RENDER_ENCLOSURE
, $this);
17 function hook_render_enclosure($entry, $hide_images) {
21 if (preg_match("/\/\/www\.youtube\.com\/v\/([\w-]+)/", $entry["url"], $matches) ||
22 preg_match("/\/\/www\.youtube\.com\/watch?v=([\w-]+)/", $entry["url"], $matches) ||
23 preg_match("/\/\/youtu.be\/([\w-]+)/", $entry["url"], $matches)) {
25 $vid_id = $matches[1];
27 return "<iframe class=\"youtube-player\"
28 type=\"text/html\" width=\"640\" height=\"385\"
29 src=\"https://www.youtube.com/embed/$vid_id\"
30 allowfullscreen frameborder=\"0\"></iframe>";
35 function api_version() {