• 1
  • 2
  • 3
  • 4(current)
  • 5
  • 6
  • 22
Release [Module] youtube-dl - multi-site playable URL resolver
#46
The dependency is fixed on my repository. It is also fixed on the official repo pending a mirrors update.
Reply
#47
Thanks so much! It works fantastic! It showed up in the official repo shortly after I posted. Works very well with the Kodi Youtube Video-Addon. I really appreciate your effort to get it working.
Reply
#48
Why can't Kodi play two streams at once: DASH video and an audio source?
Reply
#49
When resolving youtube video URLs,
is it possible to get the channel's title?
Reply
#50
Hi ruuk,

Thanks for your work on this - I thought I'd let you know that I have submitted a pull request to the YouTube Addon that will make use of this addon to download a given YouTube video.

http://forum.kodi.tv/showthread.php?tid=...pid2008034

I hope this is OK - I just thought it made sense to make use of this so there wasn't duplicate code all over the place!

Thanks

Rob
Reply
#51
(2015-05-19, 17:01)rob_webset Wrote: Hi ruuk,

Thanks for your work on this - I thought I'd let you know that I have submitted a pull request to the YouTube Addon that will make use of this addon to download a given YouTube video.

http://forum.kodi.tv/showthread.php?tid=...pid2008034

I hope this is OK - I just thought it made sense to make use of this so there wasn't duplicate code all over the place!

Thanks

Rob
The add-on is opensource and, as a module, meant to be used with other addons so of course it's OK Smile

Looks like he doesn't want the dependency though, which is probably best, as the YouTube addon is likely on most Kodi installations, and keeping it light as possible is probably a good idea. Also, since the YouTube addon already does the work of extracting the actual stream URLs, most of the work that this module does is unnecessary, and all that is needed is to implement the actual stream downloading code.
Reply
#52
(2015-04-13, 19:13)hghfdkjbfjb Wrote: Why can't Kodi play two streams at once: DASH video and an audio source?

I believe it is because it uses ffmpeg which doesn't support DASH yet in it's mainline code.
I think that support for it is coming though.

(2015-05-16, 17:07)SportySpice Wrote: When resolving youtube video URLs,
is it possible to get the channel's title?

When you call getVideoInfo() you get a VideoInfo object. Check out the .info attribute of that object as it contains the original dict of data that the youtube-dl code parsed out.
Reply
#53
Hi ruuk,

Thank you for all your hard work! I Love Youtube-dl and use it often. I have recently run into an issue where after downloading a file and youtube-dl graphic confirming completion no file is saved to disk... not sure why it is happening with certain files and not others. Please let me know if you need specific info on file locations online so you can check out issue...

Also I would love to learn more and perhaps learn how to become more involved in writing extractors etc to support community... I am doing Python tutorials now and would love recommendations of where to educate myself with Youtube-dl and Youtube-dl Kodi....

in Gratitude,
theGuruWithin
Reply
#54
Only posting this for others with the issue, I wasn't seeing Kodi in my device list despite being authorised, turned on logging and saw that youtube-dl was not available, it had been disabled somehow, reenabling and adding the device in the config menu and restarting Kodi solved the issue. It seems youtube-dl is necessary to add Kodi to Pushbullet, might want to add an error message or something since adding without youtube-dl simply shows the 'about' page.
Reply
#55
Hi,
I am trying to use youtube-dl control to download a video (on windows)
I get this error:
Error: m3u8 download detected but ffmpeg or avconv could not be found
ps.
youtube.com download works fine.
Reply
#56
(2015-08-19, 05:56)tirani Wrote: Hi,
I am trying to use youtube-dl control to download a video (on windows)
I get this error:
Error: m3u8 download detected but ffmpeg or avconv could not be found
ps.
youtube.com download works fine.

Some streams cannot be downloaded within the add-on and youtube-dl needs to use an external program. This is what the message is telling you. You need ffmpeg installed to download this stream.
Reply
#57
ruuk this is a really great add-on. Just wondered if you have a solution to an issue though, basically sometimes a download will go to the tmp folder but will get instantly deleted before it has moved to the selected folder. This is why I think some people have mentioned downloads not working even though the icon appears saying download complete. It is downloading but it is deleting the video when the download has completed without copying the file. I don't know if there is a fix to this, but if not would it be possible to perhaps change the settings so that the app no longer deletes the tmp files upon downloading? Maybe that would solve the issue?
Reply
#58
I am trying to make my first kodi addon using an example addon on Github (https://github.com/romanvm/plugin.video.example …) .. Its pretty basic stuff & I have my own addon working with files hosted on my own server but I cannot figure out how to add youtube videos. I guessing I need to import youtube-dl and have added this to my addon.xml but cannot figure out how to implement the second part of the code into my main.py

How do I add the first code below to the second ?
Code:
import YDStreamExtractor
YDStreamExtractor.disableDASHVideo(True) #Kodi (XBMC) only plays the video for DASH streams, so you don't want these normally. Of course these are the only 1080p streams on YouTube

url = "http://www.youtube.com/watch?v=_yVv9dx88x0" #a youtube ID will work as well and of course you could pass the url of another site
vid = YDStreamExtractor.getVideoInfo(url,quality=1) #quality is 0=SD, 1=720p, 2=1080p and is a maximum
stream_url = vid.streamURL() #This is what Kodi (XBMC) will play

Code:
# -*- coding: utf-8 -*-
# Module: default
# Author: Roman V. M.
# Created on: 28.11.2014
# License: GPL v.3 https://www.gnu.org/copyleft/gpl.html

import sys
from urlparse import parse_qsl
import xbmcgui
import xbmcplugin

# Get the plugin url in plugin:// notation.
__url__ = sys.argv[0]
# Get the plugin handle as an integer number.
__handle__ = int(sys.argv[1])

# Free sample videos are provided by www.vidsplay.com
# Here we use a fixed set of properties simply for demonstrating purposes
# In a "real life" plugin you will need to get info and links to video files/streams
# from some web-site or online service.
VIDEOS = {'Test Video': [{'name': 'Crab',
                       'thumb': 'http://www.vidsplay.com/vids/crab.jpg',
                       'video': 'https://www.youtube.com/watch?v=vrqJ89M7hxg',
                       'genre': 'Kodi'},
                    
                     ]}


def get_categories():
    """
    Get the list of video categories.
    Here you can insert some parsing code that retrieves
    the list of video categories (e.g. 'Movies', 'TV-shows', 'Documentaries' etc.)
    from some site or server.
    :return: list
    """
    return VIDEOS.keys()


def get_videos(category):
    """
    Get the list of videofiles/streams.
    Here you can insert some parsing code that retrieves
    the list of videostreams in a given category from some site or server.
    :param category: str
    :return: list
    """
    return VIDEOS[category]


def list_categories():
    """
    Create the list of video categories in the Kodi interface.
    :return: None
    """
    # Get video categories
    categories = get_categories()
    # Create a list for our items.
    listing = []
    # Iterate through categories
    for category in categories:
        # Create a list item with a text label and a thumbnail image.
        list_item = xbmcgui.ListItem(label=category, thumbnailImage=VIDEOS[category][0]['thumb'])
        # Set a fanart image for the list item.
        # Here we use the same image as the thumbnail for simplicity's sake.
        list_item.setProperty('fanart_image', VIDEOS[category][0]['thumb'])
        # Set additional info for the list item.
        # Here we use a category name for both properties for for simplicity's sake.
        # setInfo allows to set various information for an item.
        # For available properties see the following link:
        # http://mirrors.xbmc.org/docs/python-docs/15.x-isengard/xbmcgui.html#ListItem-setInfo
        list_item.setInfo('video', {'title': category, 'genre': category})
        # Create a URL for the plugin recursive callback.
        # Example: plugin://plugin.video.example/?action=listing&category=Animals
        url = '{0}?action=listing&category={1}'.format(__url__, category)
        # is_folder = True means that this item opens a sub-list of lower level items.
        is_folder = True
        # Add our item to the listing as a 3-element tuple.
        listing.append((url, list_item, is_folder))
    # Add our listing to Kodi.
    # Large lists and/or slower systems benefit from adding all items at once via addDirectoryItems
    # instead of adding one by ove via addDirectoryItem.
    xbmcplugin.addDirectoryItems(__handle__, listing, len(listing))
    # 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 list_videos(category):
    """
    Create the list of playable videos in the Kodi interface.
    :param category: str
    :return: None
    """
    # Get the list of videos in the category.
    videos = get_videos(category)
    # Create a list for our items.
    listing = []
    # Iterate through videos.
    for video in videos:
        # Create a list item with a text label and a thumbnail image.
        list_item = xbmcgui.ListItem(label=video['name'], thumbnailImage=video['thumb'])
        # Set a fanart image for the list item.
        # Here we use the same image as the thumbnail for simplicity's sake.
        list_item.setProperty('fanart_image', video['thumb'])
        # Set additional info for the list item.
        list_item.setInfo('video', {'title': video['name'], 'genre': video['genre']})
        # Set 'IsPlayable' property to 'true'.
        # This is mandatory for playable items!
        list_item.setProperty('IsPlayable', 'true')
        # Create a URL for the plugin recursive callback.
        # Example: plugin://plugin.video.example/?action=play&video=http://www.vidsplay.com/vids/crab.mp4
        url = '{0}?action=play&video={1}'.format(__url__, video['video'])
        # Add the list item to a virtual Kodi folder.
        # is_folder = False means that this item won't open any sub-list.
        is_folder = False
        # Add our item to the listing as a 3-element tuple.
        listing.append((url, list_item, is_folder))
    # Add our listing to Kodi.
    # Large lists and/or slower systems benefit from adding all items at once via addDirectoryItems
    # instead of adding one by ove via addDirectoryItem.
    xbmcplugin.addDirectoryItems(__handle__, listing, len(listing))
    # 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(path):
    """
    Play a video by the provided path.
    :param path: str
    :return: None
    """
    # Create a playable item with a path to play.
    play_item = xbmcgui.ListItem(path=path)
    # Pass the item to the Kodi player.
    xbmcplugin.setResolvedUrl(__handle__, True, listitem=play_item)


def router(paramstring):
    """
    Router function that calls other functions
    depending on the provided paramstring
    :param paramstring:
    :return:
    """
    # Parse a URL-encoded paramstring to the dictionary of
    # {<parameter>: <value>} elements
    params = dict(parse_qsl(paramstring[1:]))
    # Check the parameters passed to the plugin
    if params:
        if params['action'] == 'listing':
            # Display the list of videos in a provided category.
            list_videos(params['category'])
        elif params['action'] == 'play':
            # Play a video from a provided URL.
            play_video(params['video'])
    else:
        # If the plugin is called from Kodi UI without any parameters,
        # display the list of video categories
        list_categories()


if __name__ == '__main__':
    # Call the router function and pass the plugin call parameters to it.
    router(sys.argv[2])
Reply
#59
Anyone?
Reply
#60
Here's a working example: https://github.com/skipmodea1/plugin.vid...op_play.py
Reply
  • 1
  • 2
  • 3
  • 4(current)
  • 5
  • 6
  • 22

Logout Mark Read Team Forum Stats Members Help
[Module] youtube-dl - multi-site playable URL resolver2