fullurl0 = req.get.linkif not fullurl0 or fullurl0 == "" then fullurl0 = "https://www.youtube.com/watch?v=vWGhEKJZ2yI"end-- Khởi tạo function cần thiết cho các pluginlocal function checkExtension(one) extensions = { image = {'jpg', 'png', 'webp', 'psd', 'heic'}, video = {'mp4', 'mkv', 'webm', 'flv', '3gp'}, audio = {'mp3', 'mkv', 'm4a', 'flac', 'wav'}, text = {'docx', 'doc', 'txt', 'md', 'odt'}, word = {'docx', 'doc', 'odt'}, excel = {'xls', 'xlsx'}, powerpoint = {'ppt', 'pptx'}, pdf = {'pdf'}, archive = {'zip', 'rar', '7z', 'tar'}, code = {'cpp', 'cs', 'php', 'html', 'js', 'py'}, sql = {'sql'} } extension = one:match("[^.]+$") if extensions.image[extension] then return 'file-image-o' elseif extensions.video[extension] then return 'file-video-o' elseif extensions.audio[extension] then return 'file-audio-o' elseif extensions.text[extension] then return 'file-text-o' elseif extensions.word[extension] then return 'file-word-o' elseif extensions.excel[extension] then return 'file-excel-o' elseif extensions.powerpoint[extension] then return 'file-powerpoint-o' elseif extensions.pdf[extension] then return 'file-pdf-o' elseif extensions.archive[extension] then return 'file-archive-o' elseif extensions.code[extension] then return 'file-code-o' elseif extensions.sql[extension] then return 'database' else return 'file-o' endendlocal function get_youtube_id(url) local pattern = "(?:http(?:s)?://)?(?:www%.)(?:youtube%.com/watch%?v=|youtu%.be/)([%w_-]+)" local id = string.match(url, pattern) if not id then pattern = "[?&]v=([%w%-_]+)" id = string.match(url, pattern) end return idendlocal function render_youtube_iframe(url) local vidUrl = get_youtube_id(url) return ""endlocal function render_dplayer(url) return string.format([[ ]], url)endlocal function render_noembed(url) return string.format([[ ]], url)endlocal function render_content(fullurl) if string.find(string.lower(fullurl), 'youtube') or string.find(string.lower(fullurl), 'youtu.be/') then return render_youtube_iframe(fullurl) elseif checkExtension(fullurl) == 'file-audio-o' or checkExtension(fullurl) == 'file-video-o' then return render_dplayer(fullurl) else return render_noembed(fullurl) endendprint([[]])print(render_content(fullurl0))