add_hook($host::HOOK_ARTICLE_FILTER, $this); } function hook_article_filter($article) { if (strpos($article["link"], "youtube.com") !== false) { $video_url_prefix = 'https://www.youtube.com/watch?v='; $short_url_prefix = 'https://www.youtube.com/shorts/'; $is_short = substr($article["link"], 0, strlen($short_url_prefix)) === $short_url_prefix; $video_id = str_replace($is_short ? $short_url_prefix : $video_url_prefix, '', $article["link"]); $article["content"] = ''.$article['; } return $article; } function api_version() { return 2; } }