Skip to content

Commit

Permalink
yt fix live stream with user/channel url
Browse files Browse the repository at this point in the history
  • Loading branch information
satbaby committed Dec 25, 2023
1 parent c8e070a commit 6d411d9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions plugins/webtv/yt_live.lua
Expand Up @@ -76,6 +76,16 @@ end

function getVideoData(yurl)
if yurl == nil then return 0 end

if yurl:find("www.youtube.com/user/") or yurl:find("youtube.com/channel") or yurl:find("youtube.com/c/") or yurl:find("youtube.com/@") then --check user link or channel alias
local youtube_user = getdata(yurl)
if youtube_user == nil then return 0 end
local youtube_live_url = youtube_user:match('"url":"(/watch.-)"') or youtube_user:match('feature=c4.-href="(/watch.-)"') or youtube_user:match('ytimg.com\\/vi\\/([a-zA-Z0-9_$%[%]]+)\\/default_live')
if youtube_live_url == nil then return 0 end
if not youtube_live_url:find("/watch") then youtube_live_url = "/watch?v=" .. youtube_live_url end
yurl = 'https://www.youtube.com' .. youtube_live_url
end

local h = hintbox.new{caption="Please Wait ...", text="I'm Thinking."}
if h then
h:paint()
Expand Down

0 comments on commit 6d411d9

Please sign in to comment.