Giter Site home page Giter Site logo

script.module.youtube.dl's People

Contributors

amotzkau avatar curlingtongs avatar ddanssaert avatar eng2heb avatar hojel avatar koying avatar quihico avatar roliverosc avatar ruuk avatar sy6sy2 avatar tyl0re avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

script.module.youtube.dl's Issues

TypeError: __class__ assignment: only for heap types (YoutubeDLWrapper.py, line 27)

Hi, I am using LibreELEC 8.2.1 (Krypton 17.6) / LibreELEC 8.2.01 (Krypton 17.5) and entered the following error when importing script.module.youtube.dl (17.709.0) in my addon.xml with

<import addon="script.module.youtube.dl" version="17.709.0"/>

The log contains:

13:01:48.167 T:1470624672 NOTICE: script.module.youtube.dl: youtube_dl core version: 2017.07.09
13:05:21.647 T:1858073504 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.TypeError'>
Error Contents: class assignment: only for heap types
Traceback (most recent call last):
File "/storage/.kodi/addons/plugin.video.hdp_ims/addon.py", line 26, in
import YDStreamExtractor
File "/storage/.kodi/addons/script.module.youtube.dl/lib/YDStreamExtractor.py", line 8, in
import YoutubeDLWrapper
File "/storage/.kodi/addons/script.module.youtube.dl/lib/YoutubeDLWrapper.py", line 27, in
sys.stderr.class = replacement_stderr
TypeError: class assignment: only for heap types
-->End of Python script error report<--

For now, I comment out line 27 in YoutubeDLWrapper.py as

#sys.stderr.__class__ = replacement_stderr

and everything works for me (I only use "YDStreamExtractor.getVideoInfo()" and "vid.streamURL()")

However, the situation still exists. Is this issue already known? Or I am doing something wrong?

(I understand there is a reason to replace sys.stderr, but why does it seem that only I am hit by this error?)

youtube-dl control In French

Hello, I come to you to be able to translate into French of your Addons that interests me very much I have translated the file strings.po and addon.xml

addons.xml

executable all Module providing access to youtube-dl video stream extraction Module providing access to youtube-dl video stream extraction for hundreds of sites. Version is based on youtube-dl date version: YY.MDD.V where V is the addon specific sub-version. Also provides downloading with the option for background downloading with a queue and queue manager. Youtube-dl permet d'extrait des flux vidéo Module permettant d'accéder à l'extraction de flux vidéo sur des centaines de sites. La version est basée sur la version en date youtube-dl: YY.MDD.V où V est la sous-version spécifique. Fournit également le téléchargement avec l'option de téléchargement d'arrière-plan avec un gestionnaire de file d'attente. GNU GENERAL PUBLIC LICENSE. Version 2, June 1991 http://forum.xbmc.org/showthread.php?tid=200877 http://github.com/ruuk/script.module.youtube.dl

stings.po

XBMC Media Center language file

msgid ""
msgstr ""
"Project-Id-Version: XBMC-Addons\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2013-12-12 22:56+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME EMAIL@ADDRESS\n"
"Language-Team: LANGUAGE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"

msgctxt "#32001"
msgid "ETA"
msgstr "ETA"

msgctxt "#32002"
msgid "Size"
msgstr "Taille"

msgctxt "#32003"
msgid "Received"
msgstr "Reçu"

msgctxt "#32004"
msgid "Downloading"
msgstr "Téléchargement"

msgctxt "#32005"
msgid "Use Default?"
msgstr "Chemin par défaut?"

msgctxt "#32006"
msgid "Use default path:"
msgstr "Utiliser le chemin d'accès par défaut:"

msgctxt "#32007"
msgid "Or choose a new path?"
msgstr "Ou choisir un nouveau chemin?"

msgctxt "#32008"
msgid "Default"
msgstr "Défaut"

msgctxt "#32009"
msgid "New"
msgstr "Nouveau"

msgctxt "#32010"
msgid "Select Directory"
msgstr "Sélectionnez le répertoire"

msgctxt "#32011"
msgid "Done"
msgstr "Terminé"

msgctxt "#32012"
msgid "Download Complete"
msgstr "Téléchargement complété"

msgctxt "#32013"
msgid "Download Failed"
msgstr "Échec du téléchargement"

msgctxt "#32014"
msgid "SD Only"
msgstr "SD uniquement"

msgctxt "#32015"
msgid "720p"
msgstr "720p"

msgctxt "#32016"
msgid "1080p"
msgstr "1080p"

msgctxt "#32017"
msgid "Max Streaming Video Quality"
msgstr "Qualité vidéo max du Streaming"

msgctxt "#32018"
msgid "Disable DASH Video (Recommended)"
msgstr "Désactiver DASH Video (recommandé)"

msgctxt "#32019"
msgid "Main"
msgstr "Principal"

msgctxt "#32020"
msgid "Advanced"
msgstr "Avancée"

msgctxt "#32021"
msgid "Use user updated youtube-dl core version"
msgstr "Utiliser la version de base utilisateur mis à jour"

msgctxt "#32022"
msgid "Update automatically"
msgstr "Mise à jour automatique"

msgctxt "#32023"
msgid "Update now"
msgstr "Mettre à jour maintenant"

msgctxt "#32024"
msgid "View youtube-dl core info"
msgstr "Voir informations de base"

msgctxt "#32025"
msgid "Debug Logging"
msgstr "Journalisation de débogage"

msgctxt "#32026"
msgid "Highest Available"
msgstr "Haute disponibilité"

msgctxt "#32027"
msgid "Enable youtube-dl verbose logging"
msgstr "Activer l'enregistrement détaillé"

msgctxt "#32028"
msgid "Confirm download path"
msgstr "Confirmer le chemin du téléchargement"

msgctxt "#32029"
msgid "Download path"
msgstr "Chemin du téléchargement"

msgctxt "#32030"
msgid "Stop Current Download"
msgstr "Arrêter le téléchargement actuel"

msgctxt "#32031"
msgid "Stop All Downloads"
msgstr "Arrêter tous les téléchargements"

msgctxt "#32032"
msgid "Manage Queue"
msgstr "Gestion de file d'attente"

msgctxt "#32033"
msgid "Download Currently Playing Video"
msgstr "Télécharger la vidéo en cours"

msgctxt "#32034"
msgid "Settings"
msgstr "Paramètres"

msgctxt "#32035"
msgid "Message"
msgstr "Message"

msgctxt "#32036"
msgid "Failed"
msgstr "Échoué"

msgctxt "#32037"
msgid "Failed to move to downloads folder - leaving in temp"
msgstr "Impossible de passer au dossier de téléchargement - laissé dans temp"

msgctxt "#32038"
msgid "Skip Videos Without Audio"
msgstr "Ne pas prendre des vidéos sans audio"

By against I noticed that he missed the sentence to translate
attached photo
sans titre
I did not find in the .po file
by thanking you

Dependency not met error b/d of module.addon.signals

Looks like new version 15.318.0 has "dependency not met" error . I suspect this module does not get installed automatically :

I search online for the module and i did not find any.

Can you please look into this issue? Thanks

socks.py line 29 Struct() Argument 1 must be string not unicode

File "/storage/.kodi/addons/plugin.video.testaddon/addon.py", line 9, in
from YDStreamExtractor import getVideoInfo
File "/storage/.kodi/addons/script.module.youtube.dl/lib/YDStreamExtractor.py", line 8, in
import YoutubeDLWrapper
File "/storage/.kodi/addons/script.module.youtube.dl/lib/YoutubeDLWrapper.py", line 13, in
from youtube_dl.utils import std_headers, DownloadError # noqa E402
File "/storage/.kodi/addons/script.module.youtube.dl/lib/youtube_dl/init.py", line 15, in
from .options import (
File "/storage/.kodi/addons/script.module.youtube.dl/lib/youtube_dl/options.py", line 7, in
from .downloader.external import list_external_downloaders
File "/storage/.kodi/addons/script.module.youtube.dl/lib/youtube_dl/downloader/init.py", line 3, in
from .common import FileDownloader
File "/storage/.kodi/addons/script.module.youtube.dl/lib/youtube_dl/downloader/common.py", line 9, in
from ..utils import (
File "/storage/.kodi/addons/script.module.youtube.dl/lib/youtube_dl/utils.py", line 60, in
from .socks import (
File "/storage/.kodi/addons/script.module.youtube.dl/lib/youtube_dl/socks.py", line 29, in
SOCKS4_DEFAULT_DSTIP = compat_struct_pack('!BBBB', 0, 0, 0, 0xFF)
TypeError: Struct() argument 1 must be string, not unicode

just for testing purposes when i comment out the line 29

SOCKS4_DEFAULT_DSTIP = compat_struct_pack('!BBBB', 0, 0, 0, 0xFF)

it works again.

Make script Python 3 compatible

I'm currently working on making my Kodi plugins to work with Python 3 (see https://kodi.tv/article/attention-addon-developers-migration-python-3). It is suggested to make all the plugins/scripts compatible with both, Python 2 and Python 3, so that the transition will be smooth.

Currently, script.module.youtube.dl does not work with Python 3. On a Python 3 Kodi test build, I get the following error, when I try to import it:

script.module.youtube.dl/lib/YDStreamExtractor.py", line 418
                                                except YoutubeDLWrapper.youtube_dl.DownloadError, e:
                                                                                                ^
                                            SyntaxError: invalid syntax

There are probably many more lines, where the code is not compatible to Python 3.

Is it planned to release script.module.youtube.dl with Python 3 support?

Fail on resolving Sohu video URL

In original youtube-dl, the Sohu URL is converted to the proper URL with the message:
[debug] Command-line args: ['http://my.tv.sohu.com/u/vw/69428621', '-v']
[redirect] Following redirect to http://my.tv.sohu.com/us/209274639/69428621.shtml

This module, however, reports the following error message.
NOTICE: script.module.youtube.dl - _getYoutubeDLVideo() failed::getVideoInfo (392) - ERROR: no suitable InfoExtractor: http://my.tv.sohu.com/u/vw/69428621

It seems it treats redirection as error.

Youtube videos from .htm links failing to resolve

When trying to resolve links ending in .htm, which are in a directory created in a loop from a list of all my collected links, the youtube links that are collected always fail. Below is the relevant log data

11:50:34.261 T:7784   DEBUG: CGUIWindowVideoBase::OnPlayMedia plugin://plugin.video.Squeee/?resolve=http%3A%2F%2Fwww.dailyhaha.com%2F_vids%2Fwho-wants-to-go-for-a-walk.htm
11:50:34.261 T:7232   DEBUG: CAnnouncementManager - Announcement: OnClear from xbmc
11:50:34.261 T:7232   DEBUG: GOT ANNOUNCEMENT, type: 2, from xbmc, message OnClear
11:50:34.261 T:7232   DEBUG: CAnnouncementManager - Announcement: OnAdd from xbmc
11:50:34.261 T:7232   DEBUG: GOT ANNOUNCEMENT, type: 2, from xbmc, message OnAdd
11:50:34.261 T:7784   DEBUG: XFILE::CPluginDirectory::StartScript - calling plugin Squeee!('plugin://plugin.video.Squeee/','4','?resolve=http%3A%2F%2Fwww.dailyhaha.com%2F_vids%2Fwho-wants-to-go-for-a-walk.htm')
11:50:34.265 T:7460   DEBUG: Thread LanguageInvoker start, auto delete: false
11:50:34.267 T:7460    INFO: initializing python engine.
11:50:34.267 T:7460   DEBUG: CPythonInvoker(12, E:\Kodi\portable_data\addons\plugin.video.Squeee\addon.py): start processing
11:50:34.285 T:6532   DEBUG: Thread scriptobs start, auto delete: false
11:50:34.485 T:7784   DEBUG: ------ Window Init (DialogBusy.xml) ------
11:50:34.513 T:7460   DEBUG: -->Python Interpreter Initialized<--
11:50:34.513 T:7460   DEBUG: CPythonInvoker(12, 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"
11:50:34.514 T:7460   DEBUG: CPythonInvoker(12, 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.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
11:50:34.514 T:7460   DEBUG: CPythonInvoker(12, E:\Kodi\portable_data\addons\plugin.video.Squeee\addon.py): entering source directory E:\Kodi\portable_data\addons\plugin.video.Squeee
11:50:34.516 T:7460   DEBUG: CPythonInvoker(12, 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
11:50:37.544 T:10136   DEBUG: Thread JobWorker 10136 terminating (autodelete)
11:50:39.266 T:7784   DEBUG: ------ Window Deinit (Pointer.xml) ------
11:50:41.728 T:3112   DEBUG: Thread JobWorker 3112 terminating (autodelete)
11:50:41.781 T:5956   DEBUG: Thread JobWorker 5956 terminating (autodelete)
11:50:41.839 T:7460  NOTICE: script.module.youtube.dl: youtube_dl core version: 2017.05.18.1
11:50:43.030 T:7784   DEBUG: Activating window ID: 10138
11:50:45.363 T:7784   DEBUG: CWinEventsWin32::WndProcWindow is active
11:50:45.363 T:7784   DEBUG: CWinEventsWin32::WndProc: Focus switched to process C:\Users\mhill\Desktop\ffmpeg\bin\ffmpeg.exe
11:50:45.430 T:7784   DEBUG: CWinEventsWin32::WndProcWindow is active
11:50:46.179 T:7784   DEBUG: Previous line repeats 1 times.
11:50:46.179 T:7784   DEBUG: CWinEventsWin32::WndProc: Focus switched to process C:\Users\mhill\Desktop\ffmpeg\bin\ffprobe.exe
11:50:46.243 T:7460    INFO: CPythonInvoker(12, E:\Kodi\portable_data\addons\plugin.video.Squeee\addon.py): script successfully run
11:50:46.258 T:6532   DEBUG: Thread scriptobs 6532 terminating
11:50:46.258 T:7784    INFO: XCURL::DllLibCurlGlobal::easy_aquire - Created session to https://www.youtube.com
11:50:47.213 T:7460    INFO: Python script stopped
11:50:47.214 T:7460   DEBUG: Thread LanguageInvoker 7460 terminating
11:50:47.781 T:7784   DEBUG: CCurlFile::GetMimeType - https://www.youtube.com/watch?v=XZpOghdjZaA|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
11:50:47.789 T:7784   DEBUG: Loading settings for https://www.youtube.com/watch?v=XZpOghdjZaA|User-Agent=Mozilla%2F5.0+%28X11%3B+Linux+x86_64%3B+rv%3A10.0%29+Gecko%2F20150101+Firefox%2F47.0+%28Chrome%29
11:50:47.792 T:7784   DEBUG: CPlayerCoreFactory::GetPlayers(https://www.youtube.com/watch?v=XZpOghdjZaA|User-Agent=Mozilla%2F5.0+%28X11%3B+Linux+x86_64%3B+rv%3A10.0%29+Gecko%2F20150101+Firefox%2F47.0+%28Chrome%29)
11:50:47.792 T:7784   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: system rules
11:50:47.792 T:7784   DEBUG: CPlayerSelectionRule::GetPlayers: matches rule: system rules
11:50:47.792 T:7784   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: mms/udp
11:50:47.792 T:7784   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: lastfm/shout
11:50:47.792 T:7784   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: rtmp
11:50:47.793 T:7784   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: rtsp
11:50:47.793 T:7784   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: streams
11:50:47.793 T:7784   DEBUG: CPlayerSelectionRule::GetPlayers: matches rule: streams
11:50:47.793 T:7784   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: aacp/sdp
11:50:47.793 T:7784   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: mp2
11:50:47.793 T:7784   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: dvd
11:50:47.793 T:7784   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: dvdimage
11:50:47.793 T:7784   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: sdp/asf
11:50:47.793 T:7784   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: nsv
11:50:47.793 T:7784   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: radio
11:50:47.793 T:7784   DEBUG: CPlayerCoreFactory::GetPlayers: matched 0 rules with players
11:50:47.793 T:7784   DEBUG: CPlayerCoreFactory::GetPlayers: adding videodefaultplayer (VideoPlayer)
11:50:47.793 T:7784   DEBUG: CPlayerCoreFactory::GetPlayers: for video=1, audio=0
11:50:47.793 T:7784   DEBUG: CPlayerCoreFactory::GetPlayers: for video=1, audio=1
11:50:47.793 T:7784   DEBUG: CPlayerCoreFactory::GetPlayers: added 1 players
11:50:47.795 T:7784   DEBUG: Radio UECP (RDS) Processor - new CDVDRadioRDSData::CDVDRadioRDSData
11:50:47.795 T:7784  NOTICE: VideoPlayer: Opening: https://www.youtube.com/watch?v=XZpOghdjZaA|User-Agent=Mozilla%2F5.0+%28X11%3B+Linux+x86_64%3B+rv%3A10.0%29+Gecko%2F20150101+Firefox%2F47.0+%28Chrome%29
11:50:47.795 T:7784 WARNING: CDVDMessageQueue(player)::Put MSGQ_NOT_INITIALIZED
11:50:48.119 T:7784   DEBUG: CCurlFile::GetMimeType - https://www.youtube.com/watch?v=XZpOghdjZaA|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
11:50:48.119 T:7784   ERROR: DXVA::CProcessorHD::IsFormatSupported: Unsupported format 104 for 1.
11:50:48.119 T:7784   ERROR: DXVA::CProcessorHD::IsFormatSupported: Unsupported format 105 for 1.
11:50:48.119 T:4348   DEBUG: Thread VideoPlayer start, auto delete: false
11:50:48.120 T:4348  NOTICE: Creating InputStream
11:50:48.120 T:4348   DEBUG: CurlFile::Open(0738F16C) https://www.youtube.com/watch?v=XZpOghdjZaA
11:50:48.244 T:4348   DEBUG: CFileCache::Open - opening <watch> using cache
11:50:48.245 T:4348   DEBUG: CurlFile::Open(12A326A0) https://www.youtube.com/watch?v=XZpOghdjZaA
11:50:48.351 T:4348  NOTICE: Creating Demuxer
11:50:48.351 T:3656   DEBUG: Thread FileCache start, auto delete: false
11:50:48.619 T:7784   DEBUG: ------ Window Init (DialogBusy.xml) ------
11:50:48.620 T:7784   DEBUG: CWinEventsWin32::WndProcWindow is active
11:50:48.625 T:7784   DEBUG: ------ Window Deinit (DialogBusy.xml) ------
11:50:48.631 T:3656    INFO: CFileCache::Process - Source read didn't return any data! Hit eof(?)
11:50:48.664 T:4348   ERROR: CDVDDemuxFFmpeg::Open - error probing input format, https://www.youtube.com/watch?v=XZpOghdjZaA
11:50:48.664 T:4348   ERROR: CVideoPlayer::OpenDemuxStream - Error creating demuxer
11:50:48.664 T:4348  NOTICE: CVideoPlayer::OnExit()
11:50:48.664 T:3656   DEBUG: Thread FileCache 3656 terminating
11:50:48.665 T:4348   DEBUG: CApplication::OnPlayBackStopped: play state was 1, starting 1
11:50:48.665 T:4348   DEBUG: Thread VideoPlayer 4348 terminating
11:50:48.678 T:7784   DEBUG: CApplication::OnPlayBackStopped: play state was 3, starting 0
11:50:48.678 T:7784   ERROR: Playlist Player: skipping unplayable item: 0, path [plugin://plugin.video.Squeee/?resolve=http%3A%2F%2Fwww.dailyhaha.com%2F_vids%2Fwho-wants-to-go-for-a-walk.htm]
11:50:48.678 T:7784   DEBUG: Playlist Player: one or more items failed to play... aborting playback
11:50:48.678 T:7232   DEBUG: CAnnouncementManager - Announcement: OnStop from xbmc

What's odd is the first link works when placed in the web browser, but kodi isn't able to play it.

Below is the portion of my code where I create the directory and provide the unresolved links

#Hard-coded url, not collected with BeautifulSoup - Works fine
    url = "http://www.thatcutesite.com/squirrel-chocolate-thief/"
    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
    list_item = xbmcgui.ListItem(label='Squirrel Stealing Chocolate (YDStreamExtracter)')
    url = stream_url
    is_folder = False
    list_item.setProperty('IsPlayable','true')
    xbmcplugin.addDirectoryItem(_handle, url, list_item, is_folder)
    
    #Site 1
    r = requests.get('http://www.dailyhaha.com/videos/animals/')
    c = r.content
    #Temporary fix
    c = c.replace("SCR' + 'IPT", "SCRIPT")
    soup = BeautifulSoup(c)
    
    #Get links
    outer_video_tags = soup.findAll('a', {'class': 'item video'})
    #Get video titles
    video_titles = soup.findAll('div', {'class': 'info'})
    #Get Play Count
    video_views = soup.findAll('div', {'class': 'views'})
    #Get Video Type
    video_type = soup.findAll('span', {'class': 'type'})
    
    #Remove extra metadata from title
    video_titles = [str(x).replace(str(video_views[video_titles.index(x)]),"").replace(str(video_type[video_titles.index(x)]),"") for x in video_titles]
    #video_titles = [str(x).replace(str(video_views[video_titles.index(x)]),"") for x in video_titles]
    
    unresolved_links = [link['href'] for link in outer_video_tags]

    for link in unresolved_links:
        list_item = xbmcgui.ListItem(label=str(video_titles[unresolved_links.index(link)]))
        is_folder = False
        #list_item.setProperty('Video', 'true')
        list_item.setProperty('IsPlayable','true')
        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)

And the following procedure handles resolving the link using the youtube-dl module

def play_video(link):
    """
    Play a video by the provided path.
    :param path: str
    :return: None
    """
    
    vid = YDStreamExtractor.getVideoInfo(link,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
    
    # Create a playable item with a path to play.
    play_item = xbmcgui.ListItem(path=stream_url)
    #play_item.setProperty('IsPlayable','true')
    # Pass the item to the Kodi player.
    xbmcplugin.setResolvedUrl(_handle, True, listitem=play_item)

Any idea what's going on? Am I doing something wrong or is this a limitation of the module (not being able to handle .htm urls)?

Add support for Audio Only Extract

Hi, will be nice to have in menu "Extract only audio" option. Also formats in settings will be fajn.
Its only idea, so feel free to close this issue.
Example cmd:

youtube-dl --extract-audio --audio-format mp3 https://www.youtube.com/watch\?v\=otCpCn0l4Wo

Thanks! :)

m3u8 download detected but ffmpeg or avconv could not be found on Mac OS X

Hi!

I'm on Mac OS

I try to integrate youtube-dl in my addon to download video but I'm stuck with this error message "m3u8 download detected but ffmpeg or avconv could not be found".
However I installed ffmpeg on my system with the Brew packages manager and ffmpeg is in my PATH on my user terminal.

To test I directly installed youtube-dl on the Mac with Brew and I'm able to download the video that I want to download in Kodi.

Maybe the youtube-dl Kodi addon can't find my ffmpeg ?

Thanks!

Stream Merging

Can this module call an external or internal ffmpeg to merge DASH audio and video streams like the standalone youtube-dl can call an external ffmpeg to do?

Slow URL resolve

Hi all.
Thanks in advance who want to help me.
I have kodi helix and I cannot upgrade to latest ones cause this is the last change for a x86 machine.
I've installed the yatse addon because it with the help of youtube_DL are the unique solution to see some videos on my little old media center.

The only boring thing is that sending an url from my mobile phone through yatse it spend about 20 seconds before it starts to play.
I've already contacted the author of Yatse and, after analysing the log, he says that the major contributor of this delay is due to the youtube-DL Plugin (about 17 seconds)

Sorry for the so long explanation but it is a little complicated.

After this poem... Is there anybody who want to help me please?

BTW this is the log
https://controlc.com/0c6655ec

Thanks to all
Barbaro

datetime.datetime issue

I'm trying to use script.module.youtube.dl in my own plugin like this:

addon.xml

<import addon="script.module.youtube.dl" version="20.324.0"/>

And then in my python file:

from YDStreamExtractor import getVideoInfo
info = getVideoInfo(id, 1)

This will give me an error in YoutubeDLWrapper.py at line 62:

File "/home/lixa/.kodi/addons/script.module.youtube.dl/lib/YDStreamExtractor.py", line 383, in getVideoInfo
    info = _getYoutubeDLVideo(url, quality, resolve_redirects)
File "/home/lixa/.kodi/addons/script.module.youtube.dl/lib/YDStreamExtractor.py", line 181, in _getYoutubeDLVideo
    r = ytdl.extract_info(url, download=False)
File "/home/lixa/.kodi/addons/script.module.youtube.dl/lib/youtube_dl/YoutubeDL.py", line 797, in extract_info
    ie_result = ie.extract(url)
File "/home/lixa/.kodi/addons/script.module.youtube.dl/lib/youtube_dl/extractor/common.py", line 530, in extract
    ie_result = self._real_extract(url)
File "/home/lixa/.kodi/addons/script.module.youtube.dl/lib/youtube_dl/extractor/youtube.py", line 2157, in _real_extract
    upload_date = unified_strdate(upload_date)
File "/home/lixa/.kodi/addons/script.module.youtube.dl/lib/youtube_dl/utils.py", line 2867, in unified_strdate
    upload_date = datetime.datetime.strptime(date_str, expression).strftime('%Y%m%d')
File "/home/lixa/.kodi/addons/script.module.youtube.dl/lib/YoutubeDLWrapper.py", line 62, in strptime
    return datetime.datetime(*(time.strptime(dstring, dformat)[0:6]))
AttributeError: type object 'datetime' has no attribute 'datetime'

In YoutubeDLWrapper.py, at line 62 there is this:

return datetime.datetime(*(time.strptime(dstring, dformat)[0:6]))

If I replace this with

return datetime(*(time.strptime(dstring, dformat)[0:6]))

Then it will be fine. I will get the info of the movie.

I didn't created a pull request because I don't know exactly why you have there datetime.datetime. I don't know what other implications are there. I don't use your plugin in any other way. But if you think that this wouldn't impact anything else, I can also open a pull request.

Thank you.

Add yt-dlp support

(This repository is marked deprecated, but it seems to be the only place to open issues)

The addon https://github.com/firsttris/plugin.video.sendtokodi added support for both youtube-dl and yt-dlp due to the problems in youtube-dl. I was able to easily use the yt-dlp from sendtokodi to resolve my issue. (After a one line change to sendtokodi's addon.xml to export the lib).

It seems that this addon is a more logical place to add yt-dlp than sendtokodi since this addon is already an exposed library, while sendtokodi does not expose the library.

However, since I don't use the wrapper code I don't know what is involved in modifying that functionality to use yt-dlp.

Ffmpeg not found in NvidiaShield (android)

Hello,

I have this issue : "m3u8 download detected but ffmpeg or avconv could not be found" on my shield with using 'scritpt.module.youtube.dl'.

I check and there is some tutorial to install ffmpeg android build on the rooted device. I don't want to root it.
Do you know some tutorial to use YTDL -> FFMPEG on android device not rooted ?

Best Regards,

Help need to convert stream

Hello, I am using your script to download content from my hoster but my content is encoded using aes-128-ctr.

How can i decrypt the stream during the download ?

Thanx for your help. Regards

Settings Menu Broken since Upgrading to Kodi 18.4

Hi ruuk,

Hope you have been well...

Since upgrading from LibreELEC ver 8.2.5 Kodi 17.6 to LibreELEC ver. 9.1.502 Kodi 18.4) on RaspberryPi Youtube.dl ver 19.912.0 and ver 15.318.0 are both broken...

Issues

  1. the Settings Menu is garbled showing 2 fields field a. says Soften and has radio button which is not accessible and field b. which just has a garbled ?0? and up down selectors... No other settings show in Menu.

  2. Youtube.dl will still download but ignores default download location and "Manage Queue ()" is greyed out and is not accessible during downloading multiple downloads in cue. So it is impossible to delete any files set to download from cue.

Any thoughts?

Thank you in advance for your help,

In Gratitude,
A

update youtube-dl core version

Hello ruuk,

i had to update youtube-dl core to get soundcloud and youtube working properly.
can you update it in your module?

best regards
tristan

openload issue

hi,
i am trying to get the streaming link from openload and all i get is jibrish,
i looked in the openload extractor and saw some function there that gets the stream decoded value.
how did you get it?
can you explain please,
thanks,
'''
ol_id = self._search_regex(
'<span[^>]+id="[^"]+"[^>]*>([0-9A-Za-z]+)',
webpage, 'openload ID')

    decoded = ''
    a = ol_id[0:24]
    b = []
    for i in range(0, len(a), 8):
        b.append(int(a[i:i + 8] or '0', 16))
    ol_id = ol_id[24:]
    j = 0
    k = 0
    while j < len(ol_id):
        c = 128
        d = 0
        e = 0
        f = 0
        _more = True
        while _more:
            if j + 1 >= len(ol_id):
                c = 143
            f = int(ol_id[j:j + 2] or '0', 16)
            j += 2
            d += (f & 127) << e
            e += 7
            _more = f >= c
        g = d ^ b[k % 3]
        for i in range(4):
            char_dec = (g >> 8 * i) & (c + 127)
            char = compat_chr(char_dec)
            if char != '#':
                decoded += char
        k += 1

'''

Tudou problem with pulling segmented video instead of full length?

Add support for youtube subtitle.

youtube subtitle are not embedded within the video. They are external vtt files and you have to invoke the youtube-dl program with the "--write-srt" option to detect and download them and i wonder if there is a way for you addon to pass this subtitle files to kodi ?

option for saving path when calling handledownload() function

I would like to see an option for saving path in the hadledownload() function so when calling from individual addon i can get the download location from the addon instead of the script. I am talking about this function:
https://github.com/ruuk/script.module.youtube.dl/blob/master/lib/YDStreamExtractor.py#L297

Something like this will be sufficient. Thank you for your improvement of the script. Not big deal, take your time.
def handleDownload(info,duration=None,bg=False,path=None):
if path == None:
path = StreamUtils.getDownloadPath()

AttributeError: xbmcout instance has no attribute 'isatty'

The following python script works fine, but in the Kodi 18.3 got AttributeError: xbmcout instance has no attribute 'isatty'

ydl = youtube_dl.YoutubeDL({'outtmpl': '%(id)s%(ext)s'})

with ydl:
    result = ydl.extract_info(
        'https://www.bbc.com/persian/media-49522521',
        download=False
    )

if 'entries' in result:
    video = result['entries'][0]
else:
    video = result

video_url = video['url']
return video_url

here https://github.com/ruuk/script.module.youtube.dl/blob/master/lib/youtube_dl/extractor/common.py
if not self._downloader.params.get('no_color') and compat_os_name != 'nt' and sys.stderr.isatty():

I could not detect where the error comes from or some workaround. Any help would be appreciated.

TypeError: sendSignal() got an unexpected keyword argument 'sourceID'

Not sure if this is the place to ask for help but youtube-dl control stopped working after last OSMC update. Here's the log info:

13:17:37.175 T:716391408 WARNING: CPythonInvoker(294): Script invoked without an addon. Adding all addon modules installed to python path as fallback. This behaviour will $
13:17:40.006 T:716391408 NOTICE: script.module.youtube.dl: youtube_dl core version: 2017.07.09
13:17:40.010 T:716391408 NOTICE: script.module.youtube.dl: DOWNLOAD SERVICE: START
13:17:40.013 T:716391408 NOTICE: script.module.youtube.dl: Loading from queue. #1 this session
13:17:40.874 T:819450864 ERROR: Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/osmc/.kodi/addons/script.module.youtube.dl/lib/YDStreamExtractor.py", line 320, in _handleDownload
result = download(info, util.TMP_PATH)
File "/home/osmc/.kodi/addons/script.module.youtube.dl/lib/YDStreamExtractor.py", line 425, in download
AddonSignals.sendSignal('download.finished', signalPayload, sourceID='script.module.youtube.dl')
TypeError: sendSignal() got an unexpected keyword argument 'sourceID'
13:17:40.917 T:716391408 NOTICE: script.module.youtube.dl: DOWNLOAD SERVICE: FINISHED

Error in a fresh osmc install

I'm getting an error after installing the script in osmc (fresh install). Could be a problem with python version? an enconding problem?

20:05:12.415 T:1323820016 WARNING: Attempt to use invalid handle -1
20:05:14.508 T:1323820016 WARNING: Previous line repeats 4 times.
20:05:14.508 T:1323820016 NOTICE: script.module.youtube.dl: youtube_dl core version: 2017.07.09
20:05:35.383 T:1340597232 WARNING: CPythonInvoker(16): Script invoked without an addon. Adding all addon modules installed to python path as fallback. This behaviour will be removed in future version.
20:05:39.336 T:1340597232 NOTICE: script.module.youtube.dl: youtube_dl core version: 2017.07.09
20:05:39.341 T:1340597232 NOTICE: script.module.youtube.dl: DOWNLOAD SERVICE: START
20:05:39.347 T:1340597232 NOTICE: script.module.youtube.dl: Loading from queue. #1 this session
20:05:40.318 T:1323820016 ERROR: [debug] Encodings: locale UTF-8, fs UTF-8, out missing (instance), pref UTF-8
20:05:40.319 T:1323820016 ERROR: [debug] youtube-dl version 2017.07.09
20:05:40.420 T:1323820016 ERROR: Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/osmc/.kodi/addons/script.module.youtube.dl/lib/YDStreamExtractor.py", line 320, in _handleDownload
result = download(info, util.TMP_PATH)
File "/home/osmc/.kodi/addons/script.module.youtube.dl/lib/YDStreamExtractor.py", line 409, in download
ytdl = YoutubeDLWrapper._getYTDL()
File "/home/osmc/.kodi/addons/script.module.youtube.dl/lib/YoutubeDLWrapper.py", line 314, in _getYTDL
_YTDL = YoutubeDLWrapper({'verbose': True})
File "/home/osmc/.kodi/addons/script.module.youtube.dl/lib/YoutubeDLWrapper.py", line 190, in init
youtube_dl.YoutubeDL.init(self, *args, **kwargs)
File "/home/osmc/.kodi/addons/script.module.youtube.dl/lib/youtube_dl/YoutubeDL.py", line 403, in init
self.print_debug_header()
File "/home/osmc/.kodi/addons/script.module.youtube.dl/lib/youtube_dl/YoutubeDL.py", line 2176, in print_debug_header
platform.python_version(), platform_name()))
AttributeError: 'module' object has no attribute 'python_version'
20:05:40.460 T:1340597232 NOTICE: script.module.youtube.dl: DOWNLOAD SERVICE: FINISHED

Thanks in advance!

Download current playing video option doesn't work

Hi, Since I upgraded to Kodi 19 & the newest version of Youtube-dl I have been unable to use it to download videos as I did in the past.

Clicking on the 'Download currently playing video' option doesn't do anything.

I looked through the kodi log & found this which seems to lead to the issue.

2021-06-14 17:13:54.507 T:9936 ERROR : EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <class 'ModuleNotFoundError'>
Error Contents: No module named 'YoutubeDLWrapper'
Traceback (most recent call last):
File "C:\Users\stefm\AppData\Roaming\Kodi\addons\script.module.youtube.dl\lib\main.py", line 56, in onClick
self.main.downloadPlaying()
File "C:\Users\stefm\AppData\Roaming\Kodi\addons\script.module.youtube.dl\lib\main.py", line 99, in downloadPlaying
from lib import YDStreamExtractor
File "C:\Users\stefm\AppData\Roaming\Kodi\addons\script.module.youtube.dl\lib\YDStreamExtractor.py", line 6, in
import YoutubeDLWrapper
ModuleNotFoundError: No module named 'YoutubeDLWrapper'
-->End of Python script error report<--

RCB compatibility

Please rename util.py module to something more unique. After youtube.dl last update Rom Collection Browser addon is not working anymore because it has module with the same name.

Youtube-dl v15.318.0 works - v17.518.2 and v18.425.0 broken on my Kodi 17.6

Hi Ruuk,

Thank you for all your hard work on this wonderful plugin. I have been using for quite some time and love it.

I am currently running LibreElec Kodi 17.6 and have had problems updating youtube-dl to versions newer than 15.318.0 (which still works great).

After updating to either v 17.518.2 and v 18.425.0 the plugin refuses to download anything.

I would really appreciate your advice as to how to fix my Kodi 17.6 so it is compatible with your newer versions. I would really love to run the latest version. Thanks again.

in Gratitude,
A

Please upgrade youtube_dl's core version

The ExtendedInfo addon displays "Error no youtube id found" when trying to retrieve a video from Youtube. Manually updating the copy of youtube_dl in the addon directory solved the problem for me.

[Request] Updating to youtube-dl 2019.10.29 or newer

I am using your addon as a dependency of playthis and I want it to scrap some soundcloud links I listen to. As seen on the image, playthis uses your addon for soundcloud

screenshot000

When the resolving procedure completes, nothing is playing. Why?
Because there were some changes on the soundcloud website last month and youtube-dl broke, but it got fixed on 2019.10.29 as you can see on its changelog here.
https://github.com/ytdl-org/youtube-dl/releases/tag/2019.10.29

The same urls play fine on mpv, which uses youtube-dl internaly for the scraping.
Thank you in advance.

Tested on debian testing x64, kodi 18.5, script.module.youtube-dl 19.912.0 (on kodi), youtube-dl 2019.11.05 (on my system).

Filename

youtub-dl Addon uses the filenameof the Stream to save the Video. The Streamname is sometimes against the Restrictions of the Filesystem (For example Filename length of Windows). specially when using ffmpeg

YDStreamExtractor.overrideParam('ffmpeg_location',ffmpgdir)

The File get cownloaded by ffmpgdir in the Addon directory and afterwards moved to the Right location.
On some streams the download Failes, because the Filename is to long for windows

No Audio for most Youtube Stream

Hello,

i created a little kodi addon using youtube-dl:
https://github.com/firsttris/plugin.video.sendtokodi

the addon should actually serve as JSON-RPC endpoint for our iOS App SendToKodi.
But i also discovered that you can use it the create Playlist files. (m3u)
see Issue #8

so far... everything is working well,.. unless...

for some reason most Youtube Stream have no Audio:

Video Decoder mmal-h264 (hw)
Audio Stream: unkown, unkown, 0 bits, 0 Hz

When i download the Youtube Video using youtube-dl commandline tool
and play it on kodi (locally) i get audio:

Video Decoder mmal-vp8 (HW)
Audio Stream FL;FR vorbis 32 bits, 44 100 khz

Any thoughts ?

regards
Tristan

Use youtube-dl script in an URI

Is this possible in Kodi?

plugin://script.module.youtube.dl?url="http://youtube.com/?v=whatever"

If not? It would be awesome to have this feature!

E.g in a m3u playlist.

#EXTM3U
#EXTINF:-1 group-title="News",News stream with a 'token'
plugin://script.module.youtube.dl?url="http://news.com/livestream"

No YouTube ID Found

Hi...

Recently I began receiving the following error when trying to play or download a video from Youtube via "ExtendedInfo": No YouTube ID Found.

Any help would be much appreciated ...

I'm posting the kodi.log:

2019-06-13 12:22:28.470 T:11332 NOTICE: script.module.youtube.dl: youtube_dl core version: 2018.11.07
2019-06-13 12:22:29.732 T:9152 NOTICE: Previous line repeats 2 times.
2019-06-13 12:22:29.732 T:9152 WARNING: using DialogBusy from python results in nop now
2019-06-13 12:22:30.695 T:10852 WARNING: CPythonInvoker(18, C:\Users\oscar\AppData\Roaming\Kodi\addons\script.extendedinfo\plugin.py): the python script "C:\Users\oscar\AppData\Roaming\Kodi\addons\script.extendedinfo\plugin.py" has left several classes in memory that we couldn't clean up. The classes include: class XBMCAddon::xbmcgui::DialogBusy
2019-06-13 12:22:31.030 T:9152 ERROR: NEWADDON Unknown Video Info Key "file"
2019-06-13 12:22:31.631 T:5156 ERROR: Previous line repeats 2 times.
2019-06-13 12:22:31.631 T:5156 NOTICE: script.module.youtube.dl: youtube_dl core version: 2018.11.07
2019-06-13 12:22:31.723 T:11332 WARNING: CPythonInvoker(20, C:\Users\oscar\AppData\Roaming\Kodi\addons\script.extendedinfo\plugin.py): the python script "C:\Users\oscar\AppData\Roaming\Kodi\addons\script.extendedinfo\plugin.py" has left several classes in memory that we couldn't clean up. The classes include: class XBMCAddon::xbmcgui::DialogBusy
2019-06-13 12:22:32.188 T:5156 ERROR: NEWADDON Unknown Video Info Key "file"
2019-06-13 12:22:32.239 T:5156 ERROR: Previous line repeats 1 times.
2019-06-13 12:22:32.239 T:5156 WARNING: CPythonInvoker(22, C:\Users\oscar\AppData\Roaming\Kodi\addons\script.extendedinfo\plugin.py): the python script "C:\Users\oscar\AppData\Roaming\Kodi\addons\script.extendedinfo\plugin.py" has left several classes in memory that we couldn't clean up. The classes include: class XBMCAddon::xbmcgui::DialogBusy
2019-06-13 12:22:34.654 T:9152 WARNING: using DialogBusy from python results in nop now
2019-06-13 12:22:35.554 T:9152 ERROR: NEWADDON Unknown Video Info Key "media_type"
2019-06-13 12:22:43.338 T:9152 ERROR: Previous line repeats 19 times.
2019-06-13 12:22:43.338 T:9152 WARNING: using DialogBusy from python results in nop now
2019-06-13 12:22:43.338 T:9152 WARNING: addons must not activate DialogBusy
2019-06-13 12:22:43.350 T:9152 ERROR: [debug] Encodings: locale cp1252, fs mbcs, out missing (instance), pref cp1252
2019-06-13 12:22:43.350 T:9152 ERROR: [debug] youtube-dl version 2018.11.07
2019-06-13 12:22:43.356 T:9152 ERROR: [debug] Python version 2.7.13 (CPython) - Windows-10-10.0.18362
2019-06-13 12:22:43.359 T:9152 ERROR: [debug] exe versions: none
2019-06-13 12:22:43.359 T:9152 ERROR: [debug] Proxy map: {}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.