Regex, BeautifulSoup, or something else for scraping?
#16
(2017-06-12, 01:58)gedisony Wrote: I investigated the issue with my addon, I was a coding mistake on my part.
you can specify plugin url's in the listitem, load them up in a playlist and then kodi will call your plugin to play a video.

i was going to suggest you roll out your own "play from here" context menu entry but kodi's "play from here" worked fine.

I have to be doing something wrong then, but I don't see anything wrong. Here's the snippet of my code that creates the specific directory and the definition that resolves the links.

Code:
...
    Sources = scraper.Scraper()
    links = Sources.getLinks()
    playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
    playlist.clear()
    
    for i, (title, image, link) in enumerate(links):
        list_item = xbmcgui.ListItem(label=title)
        is_folder = False
        list_item.setProperty('IsPlayable','false')
        list_item.setArt({'poster': image, 'banner': image})
        url = get_url(resolve=link)
        playlist.add(url, list_item)
        xbmcplugin.addDirectoryItem(_handle, url, list_item, is_folder)
        
    # Add a sort method for the virtual folder items (alphabetically, ignore articles)
    xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(_handle)
    
def play_video(link):
    """
    Play a video by the provided path.
    :param path: str
    :return: None
    """
    print 'link is :' + link
    
    vid = YDStreamExtractor.getVideoInfo(link,quality=1) #quality is 0=SD, 1=720p, 2=1080p and is a maximum
    if vid is not None:
        stream_url = vid.streamURL() #This is what Kodi (XBMC) will play
        
        print 'stream_url is :' + stream_url
        
        if stream_url is not None:
            if 'youtube.com' in stream_url:
                #?v=YI9h__3MwhM|
                print stream_url.split('|')[0].split('=')[1]
                stream_url = 'plugin://plugin.video.youtube/play/?video_id=' + stream_url.split('|')[0].split('=')[1]
                xbmc.executebuiltin('PlayMedia(' + stream_url + ')')
            elif any(ext in stream_url for ext in ['.avi|','.mp4|','.m4a|','.mpeg|','.wmv|','.flv|','.aac|','.3gp|','.flc|','.ogg|']):
                stream_url = stream_url.split('|')[0]
                print "stripped stream_url is : " + stream_url
                xbmc.executebuiltin('PlayMedia(' + stream_url + ')')
            else:
                # Create a playable item with a path to play.
                play_item = xbmcgui.ListItem(path=stream_url)
                play_item.setProperty('IsPlayable','true')
                xbmcplugin.setResolvedUrl(_handle, True, listitem=play_item)
    else:
        xbmcplugin.setResolvedUrl(_handle, False, listitem=xbmcgui.ListItem())

Can you spot anything that might be the culprit?
Quote:pro·gram·mer (n): An organism capable of converting caffeine into code.
Reply
#17
this is the first time i've seen:
xbmc.executebuiltin('PlayMedia(' + stream_url + ')')
used to play video.

can you get rid of the
if 'youtube...
elif any(...
and only use the entire "else" part to play the video?
Reply
#18
I don't think you need to use playlist/playlist.add() when you're listing the directory.
Reply
#19
Unfortunately I can't since the youtube-dl stream url is given with headers appended (www.youtube.com/videoid=xyz|headersheadersheaders) and when I try to supply that to setresolvedurl it fails to play if it's a YouTube link. That's why I test if youtube is in the string and if so extract the id and just pass it to the YouTube plugin. Have you had this issue? Should that happen?

And about the playlist lines, it acts the same with and without it.
Quote:pro·gram·mer (n): An organism capable of converting caffeine into code.
Reply
#20
You must be doing something wrong. iirc, the extra stuff after the | is the useragent string. it is used to trick the server that the request is coming from a web browser.
in any case, the stream_url returned by youtube_dl is playable via setResolvedUrl

about the playlist lines;
unless you have a specific reason for it being there, just remove it.
the playlist is some sort of a global variable in the kodi system.
that problem i mentioned earlier about autoplay not working in my plugin?
it was because i have left a "playlist.clear()" when playing the video. thereby causing the autoplay/play from here to just play one item.
Reply
#21
(2017-06-12, 04:28)gedisony Wrote: You must be doing something wrong. iirc, the extra stuff after the | is the useragent string. it is used to trick the server that the request is coming from a web browser.
in any case, the stream_url returned by youtube_dl is playable via setResolvedUrl

about the playlist lines;
unless you have a specific reason for it being there, just remove it.
the playlist is some sort of a global variable in the kodi system.
that problem i mentioned earlier about autoplay not working in my plugin?
it was because i have left a "playlist.clear()" when playing the video. thereby causing the autoplay/play from here to just play one item.

I tried as you suggested by only using the following

Code:
...
    Sources = scraper.Scraper()
    links = Sources.getLinks()
    
    for i, (title, image, link) in enumerate(links):
        list_item = xbmcgui.ListItem(label=title)
        is_folder = False
        list_item.setProperty('IsPlayable','false')
        list_item.setArt({'poster': image, 'banner': image})
        url = get_url(resolve=link)
        xbmcplugin.addDirectoryItem(_handle, url, list_item, is_folder)
        
    # Add a sort method for the virtual folder items (alphabetically, ignore articles)
    xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(_handle)
    
def play_video(link):
    """
    Play a video by the provided path.
    :param path: str
    :return: None
    """
    print 'link is :' + link
    
    vid = YDStreamExtractor.getVideoInfo(link,quality=1) #quality is 0=SD, 1=720p, 2=1080p and is a maximum
    if vid is not None:
        stream_url = vid.streamURL() #This is what Kodi (XBMC) will play
        
        print 'stream_url is :' + stream_url
        
        # Create a playable item with a path to play.
        play_item = xbmcgui.ListItem(path=stream_url)
        play_item.setProperty('IsPlayable','true')
        xbmcplugin.setResolvedUrl(_handle, True, listitem=play_item)
    else:
        xbmcplugin.setResolvedUrl(_handle, False, listitem=xbmcgui.ListItem())

But, the link refuses to resolve/play. Here's the log data for the action.

Code:
08:30:33.443 T:1504   DEBUG: XFILE::CPluginDirectory::RunScriptWithParams - calling plugin Squeee!('plugin://plugin.video.Squeee/','-1','?resolve=http%3A%2F%2Fwww.dailyhaha.com%2F_vids%2Fa-cute-dog-enjoying-a-fancy-meal.htm')
08:30:33.447 T:10864   DEBUG: Thread LanguageInvoker start, auto delete: false
08:30:33.449 T:10864    INFO: initializing python engine.
08:30:33.449 T:10864   DEBUG: CPythonInvoker(9, E:\Kodi\portable_data\addons\plugin.video.Squeee\addon.py): start processing
08:30:33.720 T:10864   DEBUG: -->Python Interpreter Initialized<--
08:30:33.720 T:10864   DEBUG: CPythonInvoker(9, E:\Kodi\portable_data\addons\plugin.video.Squeee\addon.py): the source file to load is "E:\Kodi\portable_data\addons\plugin.video.Squeee\addon.py"
08:30:33.720 T:10864   DEBUG: CPythonInvoker(9, E:\Kodi\portable_data\addons\plugin.video.Squeee\addon.py): setting the Python path to E:\Kodi\portable_data\addons\plugin.video.Squeee;E:\Kodi\portable_data\addons\script.module.addon.signals\lib;E:\Kodi\portable_data\addons\script.module.beautifulsoup\lib;E:\Kodi\portable_data\addons\script.module.futures\lib;E:\Kodi\portable_data\addons\script.module.requests\lib;E:\Kodi\portable_data\addons\script.module.youtube.dl\lib;E:\Kodi\system\python\DLLs;E:\Kodi\system\python\Lib;E:\Kodi\python27.zip;E:\Kodi\system\python\lib\plat-win;E:\Kodi\system\python\lib\lib-tk;E:\Kodi;E:\Kodi\system\python;E:\Kodi\system\python\lib\site-packages
08:30:33.721 T:10864   DEBUG: CPythonInvoker(9, E:\Kodi\portable_data\addons\plugin.video.Squeee\addon.py): entering source directory E:\Kodi\portable_data\addons\plugin.video.Squeee
08:30:33.722 T:10864   DEBUG: CPythonInvoker(9, E:\Kodi\portable_data\addons\plugin.video.Squeee\addon.py): instantiating addon using automatically obtained id of "plugin.video.Squeee" dependent on version 2.1.0 of the xbmc.python api
08:30:38.440 T:1504   DEBUG: ------ Window Deinit (Pointer.xml) ------
08:30:42.774 T:10864  NOTICE: script.module.youtube.dl: youtube_dl core version: 2017.05.18.1
08:30:44.480 T:10864   DEBUG: link is :http://www.dailyhaha.com/_vids/a-cute-dog-enjoying-a-fancy-meal.htm
08:30:44.519 T:1504   DEBUG: Activating window ID: 10138
08:30:44.519 T:1504   DEBUG: ------ Window Init (DialogBusy.xml) ------
08:30:53.400 T:1504   DEBUG: CWinEventsWin32::WndProcWindow is active
08:30:53.400 T:1504   DEBUG: CWinEventsWin32::WndProc: Focus switched to process C:\Users\----\Desktop\ffmpeg\bin\ffmpeg.exe
08:30:53.468 T:1504   DEBUG: CWinEventsWin32::WndProcWindow is active
08:30:57.968 T:1504   DEBUG: Previous line repeats 1 times.
08:30:57.968 T:1504   DEBUG: CWinEventsWin32::WndProc: Focus switched to process C:\Users\----\Desktop\ffmpeg\bin\ffprobe.exe
08:30:58.022 T:10864   DEBUG: stream_url is :https://www.youtube.com/watch?v=Qnf_1laqE9I|User-Agent=Mozilla%2F5.0+%28X11%3B+Linux+x86_64%3B+rv%3A10.0%29+Gecko%2F20150101+Firefox%2F47.0+%28Chrome%29
08:30:58.032 T:1504   DEBUG: CWinEventsWin32::WndProcWindow is active
08:30:58.033 T:10864 WARNING: Attempt to use invalid handle -1
08:30:58.033 T:10864    INFO: CPythonInvoker(9, E:\Kodi\portable_data\addons\plugin.video.Squeee\addon.py): script successfully run
08:30:58.073 T:10864    INFO: Python script stopped
08:30:58.073 T:10864   DEBUG: Thread LanguageInvoker 10864 terminating
08:30:58.184 T:1504   DEBUG: ------ Window Deinit (DialogBusy.xml) ------
08:30:59.118 T:8408   DEBUG: Thread JobWorker 8408 terminating (autodelete)

When copy/pasting the stream_url directly into a browser it brings up the video. So, I'm completely lost. Any ideas?

Edit: And just for completeness, I have _handle defined in the beginning of the file
Code:
_handle = int(sys.argv[1])
Quote:pro·gram·mer (n): An organism capable of converting caffeine into code.
Reply
#22
@CaffeinatedMike

Why are you using both isFolder=False and 'isPlayable': 'false'? It is a special case when a plugin call is not invoking xbmcplugin API and does anything else.
Reply
#23
(2017-06-12, 15:21)Roman_V_M Wrote: @CaffeinatedMike

Why are you using both isFolder=False and 'isPlayable': 'false'? It is a special case when a plugin call is not invoking xbmcplugin API and does anything else.

As per your comment here
Quote:For plugin rules are the following:
- If a ListItem opens a lower lever list, it must have isFolder=True.
- If a ListItem calls a playback function that ends with setResolvedUrl, it must have setProperty('isPlayable', 'true') and IsFolder=False.
- If a ListItem does any other task except for mentioned above, is must have isFolder=False (and only this).

This way you won't have problems with invalid handles.
Aren't I supposed to set those two options as setProperty('isPlayable', 'true') and IsFolder=False since they end up calling the "play_video(link)" definition to resolve the link? What is the correct way in my situation if not?
Quote:pro·gram·mer (n): An organism capable of converting caffeine into code.
Reply
#24
@CaffeinatedMike

Read my previous post carefully once again. And then read carefully your code.
Reply
#25
(2017-06-12, 15:36)Roman_V_M Wrote: @CaffeinatedMike

Read my previous post carefully once again. And then read carefully your code.

Wow, I feel like an idiot for misreading that, especially with how many times I've referenced that post. However, changing it to leads to videos not playing. Changed to the following

Code:
for i, (title, image, link) in enumerate(links):
        list_item = xbmcgui.ListItem(label=title)
        is_folder = False
        list_item.setProperty('IsPlayable','true')
        list_item.setArt({'poster': image, 'banner': image})
        url = get_url(resolve=link)
        #playlist.add(url, list_item)
        xbmcplugin.addDirectoryItem(_handle, url, list_item, is_folder)

I was able to get the first video to play when selecting Play From Here, but after it was finished and tried going to the next video it failed. And when trying to simply click on a single video to play it fails to play. See log

Code:
09:44:44.278 T:9632   DEBUG: XFILE::CPluginDirectory::StartScript - calling plugin Squeee!('plugin://plugin.video.Squeee/','9','?resolve=http%3A%2F%2Fwww.dailyhaha.com%2F_vids%2Fbulldog-and-iguana-are-best-of-friends.htm')
09:44:44.282 T:8716   DEBUG: Thread LanguageInvoker start, auto delete: false
09:44:44.283 T:8716    INFO: initializing python engine.
09:44:44.283 T:8716   DEBUG: CPythonInvoker(16, E:\Kodi\portable_data\addons\plugin.video.Squeee\addon.py): start processing
09:44:44.301 T:4588   DEBUG: Thread scriptobs start, auto delete: false
09:44:44.501 T:9632   DEBUG: ------ Window Init (DialogBusy.xml) ------
09:44:44.534 T:8716   DEBUG: -->Python Interpreter Initialized<--
09:44:44.534 T:8716   DEBUG: CPythonInvoker(16, E:\Kodi\portable_data\addons\plugin.video.Squeee\addon.py): the source file to load is "E:\Kodi\portable_data\addons\plugin.video.Squeee\addon.py"
09:44:44.535 T:8716   DEBUG: CPythonInvoker(16, E:\Kodi\portable_data\addons\plugin.video.Squeee\addon.py): setting the Python path to E:\Kodi\portable_data\addons\plugin.video.Squeee;E:\Kodi\portable_data\addons\script.module.addon.signals\lib;E:\Kodi\portable_data\addons\script.module.beautifulsoup\lib;E:\Kodi\portable_data\addons\script.module.futures\lib;E:\Kodi\portable_data\addons\script.module.requests\lib;E:\Kodi\portable_data\addons\script.module.youtube.dl\lib;E:\Kodi\system\python\DLLs;E:\Kodi\system\python\Lib;E:\Kodi\python27.zip;E:\Kodi\system\python\lib\plat-win;E:\Kodi\system\python\lib\lib-tk;E:\Kodi;E:\Kodi\system\python;E:\Kodi\system\python\lib\site-packages
09:44:44.535 T:8716   DEBUG: CPythonInvoker(16, E:\Kodi\portable_data\addons\plugin.video.Squeee\addon.py): entering source directory E:\Kodi\portable_data\addons\plugin.video.Squeee
09:44:44.536 T:8716   DEBUG: CPythonInvoker(16, E:\Kodi\portable_data\addons\plugin.video.Squeee\addon.py): instantiating addon using automatically obtained id of "plugin.video.Squeee" dependent on version 2.1.0 of the xbmc.python api
09:44:49.607 T:9632   DEBUG: ------ Window Deinit (Pointer.xml) ------
09:44:52.209 T:8716  NOTICE: script.module.youtube.dl: youtube_dl core version: 2017.05.18.1
09:44:53.915 T:8716   DEBUG: link is :http://www.dailyhaha.com/_vids/bulldog-and-iguana-are-best-of-friends.htm
09:44:53.920 T:9632   DEBUG: Activating window ID: 10138
09:44:56.322 T:9632   DEBUG: CWinEventsWin32::WndProcWindow is active
09:44:56.322 T:9632   DEBUG: CWinEventsWin32::WndProc: Focus switched to process C:\Users\mhill\Desktop\ffmpeg\bin\ffmpeg.exe
09:44:56.388 T:9632   DEBUG: CWinEventsWin32::WndProcWindow is active
09:44:57.137 T:9632   DEBUG: Previous line repeats 1 times.
09:44:57.137 T:9632   DEBUG: CWinEventsWin32::WndProc: Focus switched to process C:\Users\mhill\Desktop\ffmpeg\bin\ffprobe.exe
09:44:57.196 T:8716   DEBUG: stream_url is :https://www.youtube.com/watch?v=C45Uaq499ig|User-Agent=Mozilla%2F5.0+%28X11%3B+Linux+x86_64%3B+rv%3A10.0%29+Gecko%2F20150101+Firefox%2F47.0+%28Chrome%29
09:44:57.203 T:8716    INFO: CPythonInvoker(16, E:\Kodi\portable_data\addons\plugin.video.Squeee\addon.py): script successfully run
09:44:57.204 T:9632   DEBUG: CWinEventsWin32::WndProcWindow is active
09:44:57.225 T:4588   DEBUG: Thread scriptobs 4588 terminating
09:44:57.265 T:8716    INFO: Python script stopped
09:44:57.265 T:8716   DEBUG: Thread LanguageInvoker 8716 terminating
09:44:57.534 T:9632   DEBUG: CCurlFile::GetMimeType - https://www.youtube.com/watch?v=C45Uaq499ig|User-Agent=Mozilla%2F5.0+%28X11%3B+Linux+x86_64%3B+rv%3A10.0%29+Gecko%2F20150101+Firefox%2F47.0+%28Chrome%29 -> x-directory/normal
09:44:57.543 T:9632   DEBUG: Loading settings for https://www.youtube.com/watch?v=C45Uaq499ig|User-Agent=Mozilla%2F5.0+%28X11%3B+Linux+x86_64%3B+rv%3A10.0%29+Gecko%2F20150101+Firefox%2F47.0+%28Chrome%29
09:44:57.546 T:9632   DEBUG: CPlayerCoreFactory::GetPlayers(https://www.youtube.com/watch?v=C45Uaq499ig|User-Agent=Mozilla%2F5.0+%28X11%3B+Linux+x86_64%3B+rv%3A10.0%29+Gecko%2F20150101+Firefox%2F47.0+%28Chrome%29)
09:44:57.546 T:9632   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: system rules
09:44:57.546 T:9632   DEBUG: CPlayerSelectionRule::GetPlayers: matches rule: system rules
09:44:57.546 T:9632   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: mms/udp
09:44:57.547 T:9632   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: lastfm/shout
09:44:57.547 T:9632   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: rtmp
09:44:57.547 T:9632   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: rtsp
09:44:57.547 T:9632   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: streams
09:44:57.547 T:9632   DEBUG: CPlayerSelectionRule::GetPlayers: matches rule: streams
09:44:57.547 T:9632   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: aacp/sdp
09:44:57.547 T:9632   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: mp2
09:44:57.547 T:9632   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: dvd
09:44:57.547 T:9632   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: dvdimage
09:44:57.547 T:9632   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: sdp/asf
09:44:57.547 T:9632   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: nsv
09:44:57.547 T:9632   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: radio
09:44:57.547 T:9632   DEBUG: CPlayerCoreFactory::GetPlayers: matched 0 rules with players
09:44:57.547 T:9632   DEBUG: CPlayerCoreFactory::GetPlayers: adding videodefaultplayer (VideoPlayer)
09:44:57.547 T:9632   DEBUG: CPlayerCoreFactory::GetPlayers: for video=1, audio=0
09:44:57.547 T:9632   DEBUG: CPlayerCoreFactory::GetPlayers: for video=1, audio=1
09:44:57.547 T:9632   DEBUG: CPlayerCoreFactory::GetPlayers: added 1 players
09:44:57.549 T:9632   DEBUG: Radio UECP (RDS) Processor - new CDVDRadioRDSData::CDVDRadioRDSData
09:44:57.549 T:9632  NOTICE: VideoPlayer: Opening: https://www.youtube.com/watch?v=C45Uaq499ig|User-Agent=Mozilla%2F5.0+%28X11%3B+Linux+x86_64%3B+rv%3A10.0%29+Gecko%2F20150101+Firefox%2F47.0+%28Chrome%29
09:44:57.549 T:9632 WARNING: CDVDMessageQueue(player)::Put MSGQ_NOT_INITIALIZED
09:44:57.819 T:9632   DEBUG: CCurlFile::GetMimeType - https://www.youtube.com/watch?v=C45Uaq499ig|User-Agent=Mozilla%2F5.0+%28X11%3B+Linux+x86_64%3B+rv%3A10.0%29+Gecko%2F20150101+Firefox%2F47.0+%28Chrome%29 -> x-directory/normal
09:44:57.819 T:9632   ERROR: DXVA::CProcessorHD::IsFormatSupported: Unsupported format 104 for 1.
09:44:57.819 T:9632   ERROR: DXVA::CProcessorHD::IsFormatSupported: Unsupported format 105 for 1.
09:44:57.819 T:2728   DEBUG: Thread VideoPlayer start, auto delete: false
09:44:57.819 T:2728  NOTICE: Creating InputStream
09:44:57.820 T:2728   DEBUG: CurlFile::Open(0761F5B4) https://www.youtube.com/watch?v=C45Uaq499ig
09:44:57.871 T:2728   DEBUG: CFileCache::Open - opening <watch> using cache
09:44:57.872 T:2728   DEBUG: CurlFile::Open(10FC1D18) https://www.youtube.com/watch?v=C45Uaq499ig
09:44:57.990 T:2728  NOTICE: Creating Demuxer
09:44:57.990 T:11016   DEBUG: Thread FileCache start, auto delete: false
09:44:58.303 T:11016    INFO: CFileCache::Process - Source read didn't return any data! Hit eof(?)
09:44:58.319 T:9632   DEBUG: ------ Window Init (DialogBusy.xml) ------
09:44:58.386 T:2728   ERROR: CDVDDemuxFFmpeg::Open - error probing input format, https://www.youtube.com/watch?v=C45Uaq499ig
09:44:58.386 T:2728   ERROR: CVideoPlayer::OpenDemuxStream - Error creating demuxer
09:44:58.386 T:2728  NOTICE: CVideoPlayer::OnExit()
09:44:58.386 T:11016   DEBUG: Thread FileCache 11016 terminating
09:44:58.386 T:2728   DEBUG: CApplication::OnPlayBackStopped: play state was 1, starting 1
09:44:58.386 T:2728   DEBUG: Thread VideoPlayer 2728 terminating
09:44:58.401 T:9632   DEBUG: CApplication::OnPlayBackStopped: play state was 3, starting 0
09:44:58.402 T:9632   ERROR: Playlist Player: skipping unplayable item: 0, path [plugin://plugin.video.Squeee/?resolve=http%3A%2F%2Fwww.dailyhaha.com%2F_vids%2Fbulldog-and-iguana-are-best-of-friends.htm]
09:44:58.402 T:9632   DEBUG: Playlist Player: one or more items failed to play... aborting playback

It appears something starts going wrong on the line
Code:
CFileCache::Process - Source read didn't return any data! Hit eof(?)
Quote:pro·gram·mer (n): An organism capable of converting caffeine into code.
Reply
#26
(2017-06-12, 15:36)Roman_V_M Wrote: @CaffeinatedMike

Read my previous post carefully once again. And then read carefully your code.

It appears to be related with youtube.com links specifically (atleast when returned from the youtube-dl function, with headers appended to the link). Here's a log with playback working for non-youtube links (single-play, plus Play From Here working) and youtube links failing with
Code:
is_folder = False
list_item.setProperty('IsPlayable','true')

Any idea what's going on?
Quote:pro·gram·mer (n): An organism capable of converting caffeine into code.
Reply
#27
I really don't know why youtube links are not working for you
this video:
http://youtube.com/v/fyVz5vgqBhE


resolves to this: (tested 2 times)
Code:
https://r1---sn-o097znlk.googlevideo.com/videoplayback?ratebypass=yes&signature=BE24DF240ED98370648B1578B9576F9ED00606B6.2845FAF7F4B83CBD5D626B7B5F12EA1F6D53120C&ei=LL0-WcGyMYiQ-wOQ94SAAQ&itag=22&sparams=dur%2Cei%2Cgcr%2Chcs%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Cshardbypass%2Csource%2Cexpire&requiressl=yes&key=yt6&source=youtube&mime=video%2Fmp4&pl=52&gcr=us&lmt=1497234768630851&hcs=yes&expire=1497305484&shardbypass=yes&initcwndbps=737500&ipbits=0&mm=31&mn=sn-o097znlk&id=o-AET4AP30wWcE__F6RWSJjmt-CHEXUAvh7Mr6Pm5cZduj&mt=1497283777&mv=m&dur=1150.618&ms=au&ip=2602%3A306%3Abc92%3Ade10%3A5040%3A1a9a%3A3e63%3Aa00|User-Agent=Mozilla%2F5.0+%28X11%3B+Linux+x86_64%3B+rv%3A10.0%29+Gecko%2F20150101+Firefox%2F47.0+%28Chrome%29
Code:
https://r3---sn-o097znlk.googlevideo.com/videoplayback?initcwndbps=723750&signature=6A16797C4DDA0388D6F90FCAFE6EC55F166571BF.E34102D0517CCAC853729EB6BE2D443CE2D7E2BF&expire=1497305737&ei=Kb4-We6wNc-M_APFq4jgCw&mime=video%2Fmp4&key=yt6&lmt=1497234768630851&shardbypass=yes&dur=1150.618&ratebypass=yes&hcs=yes&gcr=us&requiressl=yes&sparams=dur%2Cei%2Cgcr%2Chcs%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Cshardbypass%2Csource%2Cexpire&source=youtube&mn=sn-o097znlk&mt=1497284036&mv=m&ms=au&pl=52&id=o-AAbnJkU-O4gvuVzjR2BrJupuoVCkPyok0SivgwQt1YFt&ipbits=0&ip=2602%3A306%3Abc92%3Ade10%3A5040%3A1a9a%3A3e63%3Aa00&mm=31&itag=22|User-Agent=Mozilla%2F5.0+%28X11%3B+Linux+x86_64%3B+rv%3A10.0%29+Gecko%2F20150101+Firefox%2F47.0+%28Chrome%29

This goes directly to the listitem and it plays fine. (won't play on the browser though)
Reply
#28
btw, you can just parse the youtube video id fro the link and feed it to the youtube plugin. It will save the user some wait time.
also, some youtube links take a long time for youtube-dl to resolve.
you can shorten that wait time a bit by parsing for the video id and providing a simpler url like http://youtube.com/v/(video id here) or that other link with the ...watch?v=
Reply
#29
(2017-06-12, 18:25)gedisony Wrote: I really don't know why youtube links are not working for you
this video:
http://youtube.com/v/fyVz5vgqBhE


resolves to this: (tested 2 times)
Code:
https://r1---sn-o097znlk.googlevideo.com/videoplayback?ratebypass=yes&signature=BE24DF240ED98370648B1578B9576F9ED00606B6.2845FAF7F4B83CBD5D626B7B5F12EA1F6D53120C&ei=LL0-WcGyMYiQ-wOQ94SAAQ&itag=22&sparams=dur%2Cei%2Cgcr%2Chcs%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Cshardbypass%2Csource%2Cexpire&requiressl=yes&key=yt6&source=youtube&mime=video%2Fmp4&pl=52&gcr=us&lmt=1497234768630851&hcs=yes&expire=1497305484&shardbypass=yes&initcwndbps=737500&ipbits=0&mm=31&mn=sn-o097znlk&id=o-AET4AP30wWcE__F6RWSJjmt-CHEXUAvh7Mr6Pm5cZduj&mt=1497283777&mv=m&dur=1150.618&ms=au&ip=2602%3A306%3Abc92%3Ade10%3A5040%3A1a9a%3A3e63%3Aa00|User-Agent=Mozilla%2F5.0+%28X11%3B+Linux+x86_64%3B+rv%3A10.0%29+Gecko%2F20150101+Firefox%2F47.0+%28Chrome%29
Code:
https://r3---sn-o097znlk.googlevideo.com/videoplayback?initcwndbps=723750&signature=6A16797C4DDA0388D6F90FCAFE6EC55F166571BF.E34102D0517CCAC853729EB6BE2D443CE2D7E2BF&expire=1497305737&ei=Kb4-We6wNc-M_APFq4jgCw&mime=video%2Fmp4&key=yt6&lmt=1497234768630851&shardbypass=yes&dur=1150.618&ratebypass=yes&hcs=yes&gcr=us&requiressl=yes&sparams=dur%2Cei%2Cgcr%2Chcs%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Cshardbypass%2Csource%2Cexpire&source=youtube&mn=sn-o097znlk&mt=1497284036&mv=m&ms=au&pl=52&id=o-AAbnJkU-O4gvuVzjR2BrJupuoVCkPyok0SivgwQt1YFt&ipbits=0&ip=2602%3A306%3Abc92%3Ade10%3A5040%3A1a9a%3A3e63%3Aa00&mm=31&itag=22|User-Agent=Mozilla%2F5.0+%28X11%3B+Linux+x86_64%3B+rv%3A10.0%29+Gecko%2F20150101+Firefox%2F47.0+%28Chrome%29

This goes directly to the listitem and it plays fine. (won't play on the browser though)

I give up. If I try it the way Roman says it should be (isFolder = False, isPlayable = True) no videos play. Well, the first video starts to play, but immediately stops. Log says
Code:
ERROR: Playlist Player: skipping unplayable item: 4, path [plugin://plugin.video.Squeee/?resolve=http%3A%2F%2Fwww.dailyhaha.com%2F_vids%2FAdorable-Corgi-Models-Propeller-Hat.htm]
18:08:44.519 T:4436 WARNING: Attempt to set unplayable index 4
18:08:44.519 T:4436   DEBUG: Playlist Player: one or more items failed to play... aborting playback

if I use my original setup (isFolder = False, isPlayable = False) single links play fine, but Play From Here fails immediately when starting to play the first video. Log says
Code:
18:25:51.548 T:1200   DEBUG: link is :http://www.dailyhaha.com/_vids/buddy-the-beagle-playing-piano.htm
18:25:51.550 T:4436   DEBUG: Activating window ID: 10138
18:25:53.366 T:1200   DEBUG: stream_url is :https://www.youtube.com/watch?v=J6nhSDAKRj8|User-Agent=Mozilla%2F5.0+%28X11%3B+Linux+x86_64%3B+rv%3A10.0%29+Gecko%2F20150101+Firefox%2F47.0+%28Chrome%29
18:25:53.366 T:1200   DEBUG: J6nhSDAKRj8
18:25:53.366 T:1200    INFO: CPythonInvoker(33, F:\Kodi\portable_data\addons\plugin.video.Squeee\addon.py): script successfully run
18:25:53.427 T:4436   DEBUG: XFILE::CPluginDirectory::StartScript - calling plugin YouTube('plugin://plugin.video.youtube/play/','25','?video_id=J6nhSDAKRj8')
18:25:53.428 T:1200    INFO: Python script stopped
18:25:53.428 T:1200   DEBUG: Thread LanguageInvoker 1200 terminating

If I just use the code after my else statement youtube links returned from the youtube-dl resolver fail unless I pick them apart and send them to the youtube plugin. I really just have no idea what else to do, try, whatever. I'm just getting so fed up with it. I'm probably just a noob who's doing something idiotic. But, whatever I'm doing I just can't seem to get it right. Looks like I'm going to need someone to literally spell it out for me.
Quote:pro·gram·mer (n): An organism capable of converting caffeine into code.
Reply

Logout Mark Read Team Forum Stats Members Help
Regex, BeautifulSoup, or something else for scraping?0