Pass URL link into Youtube plugin

leopheard

New member
Jun 30, 2018
3
0
1
Hi all,

I have made the following code that pulls links from a Youtube feed, but the feed provided is in .swf format and Kodi can't natively play that. How would I pass this into the Kodi Youtube plugin as I'm assuming that addon can play those types of files? I don't want to use most of the code that uses the YT plugin because I can't see a way to add more than one YT channel on there.

I found the following code that allows it to be added into a .strm stream file (Kodi guide link):

plugin://plugin.video.youtube/play/?video_id=$VIDEOID

I've tried a few variations, but how would I add the above into the following output for each link|?

(link being parsed: https://www.youtube.com/feeds/videos.xml?channel_id=UChLtXXpo4Ge1ReTEboVvTDg)

def get_playable_podcast1(soup1):
subjects = []
for content in soup1.find_all('entry'):
try:
link = content.find('yt:videoId')
link = link.get()
print("\n\nLink: ", link)
thumbnail = content.find('media:thumbnail')
thumbnail = thumbnail.get('url')
title = content.find('media:title')
title = title.get_text()
except AttributeError:
continue
item = {
'yt:videoId': link,
'title': title,
'thumbnail': thumbnail,
}
subjects.append(item)
return subjects
def compile_playable_podcast1(playable_podcast1):
items = []
for podcast in playable_podcast1:
items.append({
'label': podcast['title'],
'thumbnail': podcast['thumbnail'],
'path': podcast['yt:videoId'],
'is_playable': True,
})
return items
 

streamwatcher2013

Active member
Oct 24, 2013
454
77
28
USA
@[B]leopheard[/B]

you can use the code plugin://plugin.video.youtube/play/?video_id=$VIDEOID to create the .m3u playlist and play it in PVR IPTV simple clients addons. Here is the example of the .m3u file. But the disadvantage of it you have to make a change manually every time

Code:
#EXTM3U
#EXTINF:-1,Florida businesses brace for Hurricane Dorian, boarded up
plugin://plugin.video.youtube/play/?video_id=NeHk_joNmxs
#EXTINF:-1,For every benefit, there is a similar kind of cost': UBC professor on impact of climate change
plugin://plugin.video.youtube/play/?video_id=uviXQZ219Mk
#EXTINF:-1,Hong Kong protesters rally in the central district
plugin://plugin.video.youtube/play/?video_id=Xo9iyd1Tq_I


You may want to use LSP addons and create the .xml file which follows the change of the url and auto update on it own.

The xml example:

Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<items>
<item>
<title>Global News</title>
<link>$doregex[makelist]</link>
<regex>
<name>makelist</name>
<listrepeat><![CDATA[
   <title>[makelist.param1]</title>
   <link>plugin://plugin.video.youtube/play/?video_id=[makelist.param2]</link>
   <thumbnail>https://i.ytimg.com/vi/[makelist.param2]/hqdefault.jpg</thumbnail>
   <info>[makelist.param3]</info>
]]></listrepeat>
<expres><![CDATA[(?s)media:title>([^<]+).+?v/(.*?)\?.+?description>(.*?)\n]]></expres>
<page>https://www.youtube.com/feeds/videos.xml?channel_id=UChLtXXpo4Ge1ReTEboVvTDg</page>
</regex>
<thumbnail>https://shawglobalnews.files.wordpress.com/2018/03/new_square-e1527639599961.png</thumbnail>
</item>
</item>