![]() |
Release [Module] youtube-dl - multi-site playable URL resolver - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33) +--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27) +---- Forum: Video Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=154) +---- Thread: Release [Module] youtube-dl - multi-site playable URL resolver (/showthread.php?tid=200877) |
RE: [Module] youtube-dl - multi-site playable URL resolver - Steph09 - 2021-06-14 I'm having the same issue since upgrading to Kodi 19. Whenever I click the 'download currently playing video' button nothing happens. This is what the log says. Quote:2021-06-14 17:13:54.507 T:9936 ERROR : EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<-- RE: [Module] youtube-dl - multi-site playable URL resolver - Roger79 - 2021-07-21 (2021-06-14, 20:32)Steph09 Wrote: I'm having the same issue since upgrading to Kodi 19. Whenever I click the 'download currently playing video' button nothing happens. Hi. Anyone looking into this? I have the same issue. Roger J. RE: [Module] youtube-dl - multi-site playable URL resolver - jim_p - 2021-12-16 Now that youtube-dl's development has stopped since june (6+ months ago), can we get a new version of the addon that uses yt-dlp? Yt-dlp is the successor to youtube-dl, it has frequent updates and it is even suggested by the devs of youtube-dl on its reddit and github pages. RE: [Module] youtube-dl - multi-site playable URL resolver - jim_p - 2021-12-17 Speak of the devil, youtube-dl was updated today! I hope we will see a new version of the addon soon. RE: [Module] youtube-dl - multi-site playable URL resolver - fbacher - 2021-12-30 All indications are that youtube-dl is dead. yt-dlp appears to be the successor. I am working on an update to script.module.youtube.dl that will add yt-dlp and allow an addon to specify which lib to use. The default will be yt-dlp. The intention is to remove youtube-dl before very long since it's value is minimal. I leave it mostly to help test and migrate. Unless you depend upon some code specific to one of the implementations, the change should be transparent. I hope to have this out in several weeks. My testing is limited, since I use only one call to simply download trailers and metadata. If anyone is interested in testing, please let me know. Frank RE: [Module] youtube-dl - multi-site playable URL resolver - jim_p - 2022-01-02 In a similar discussion on github, I found out that yt-dlp is python3 only. This means that its to no use for distros that come with python2 only, e.g. libreelec 9.x with kodi 18. It simply can not run there. So, the change will not be that transparent for those users, as any addon that depends on it will stop working. RE: [Module] youtube-dl - multi-site playable URL resolver - scott967 - 2022-01-03 Seems to me yt-dlp is the only viable option going forward. scott s. . RE: [Module] youtube-dl - multi-site playable URL resolver - fbacher - 2022-01-09 Perhaps I should just ditch the youtube-dl and completely switch to the yt-dlp. I won't be able to thoroughly test the youtube-dl wrapper code. I tried testing with some of the existing addons, but the problems I have found so far seem to be in the addon and not youtube-dl. RE: [Module] youtube-dl - multi-site playable URL resolver - fbacher - 2022-01-09 Jim_p, although I'm not volunteering to do the work, depending upon the use case, it is probably technically possible to add bridge code to exec yt-dlp so that it can run under python 3 and communicate via file or pipe. No, I don't want that job. Depends upon how desperate one is. RE: [Module] youtube-dl - multi-site playable URL resolver - fbacher - 2022-01-12 Since it seems youtbe-dl command a library is dead, I am in the works of updating script.module.youtube.dl to use yt-dlp instead. It appears to work well. Unfortunately, yt-dlp does NOT support python 2. It seems that youtube-dl is nearly useless at this point, so I am planning to remove it. I could leave youtube-dl there and allow it to be configured by setting, or a passed argument, but there doesn't seem to be much point in it at this point. I'm hoping to have this done soon. I have only tested basic operations, since my addon only needs to use a small portion of it's capabilities. RE: [Module] youtube-dl - multi-site playable URL resolver - jim_p - 2022-01-12 I would say that this transition does not affect me because, right now, I have no addon that uses youtube-dl. Well, playthis by anxdpanic does use it, but I use it like twice a year ![]() RE: [Module] youtube-dl - multi-site playable URL resolver - scott967 - 2022-01-13 I tried in the past to get it working in Matrix. It seemed to add to the d/l queue, but I couldn't get the queue to run. (using Runscript() from the UI while playing video). scott s. . RE: [Module] youtube-dl - multi-site playable URL resolver - fbacher - 2022-01-19 Where I am at: After much internal debate, I decided to leave script.module.youtube.dl alone and create script.module.yt-dlp in its place. I did this for several reasons:
Progress so far:
Working on this did bring up a recent concern that I have with Kodi addons. There is a bug which a draconian fix was put in. It impacts locale, etc. In particular, it broke unicode characters in filenames. The work around is easy enough (encode the file path on file open to utf-8). But this may nab a number of people. Time will tell. It also causes locale.getdefaultlocale and getPreferredEncoding to behave less than perfectly. UTF-8 still works, but there are some subtle edge cases. I'll try to have a workable version within a week. Some day I'll get to release RandomTrailers. RE: [Module] youtube-dl - multi-site playable URL resolver - fbacher - 2022-01-25 Good Progress on migrating to yt-dlp for the upcoming script.module.yt-dlp addon. This are a bit of a mess and I have done very limited testing, but I am hoping to have something deliverable in several weeks. Since the addon name will be different, other addons will not have a nasty surprise and will have opportunity to test and get fixes before switching. I had to make more changes to the code (YoutubeDLWrapper, etc.) than I like, but I found several things that had to be changed. Unfortunately I found some problems in yt-dlp & youtube-dl that are greatly aggravated by Kodi's utf-8 hack for Turkish (but the 'fix' impacts many codesets). Most likely, this will prevent you from downloading any file with names that are non-ASCII. There are circumstances where non-ASCII content may cause trouble as well. I started hacking yt-dlp to see how difficult it would be to fix, but it is a very sizable chunk. There is code to attempt to address it, probably put in for Unicode Migration, but there are bugs and inconsistencies that likely only show up in stress situations such as these. For the curious: the problem is that there is encoding for the contents of a file, that we all know and love. There is also encoding for the file name, which depends upon what the OS allows. Nearly all OS's these days support utf-8 for both file names and content. During startup Python does some magic and set up default encodings for file names as well as regular strings. The hack for Kodi disabled these, causing the default encoding for file names to be ASCII. The default (nearly) can not be changed after startup, but the consequences of changing it are bad, so don't go down that route. The default encoding for strings is utf-8, but there are some warts on the locale. RE: [Module] youtube-dl - multi-site playable URL resolver - finnhubb - 2022-03-28 @fbacher thanks for the detailed post. Are you still working on this? I don't know about Kodi's utf-8 hack for Turkish exactly, but I do notice Kodi changing reasonable locale and filesystem encoding settings. In my addon I was able to download files with non-ASCII names (from yle, not youtube) and display them correctly within Kodi. I will give a quick explanation of my approach here in becomes useful. Overview: - Extract filename (and download link) into python string (unicode code points). - Set download directory, using `xbmcvfs.translatePath()` if required. - Append filename (utf-8 encoded) to complete download path. - Download file - Open filename (utf-8 encoded) and write downloaded data as binary data. - Pass filename (utf-8 encoded) and path to Kodi as list item.
Obviously this code is incomplete, and requires setting relevant `addon_id` and `_handle` and having a function to handle "local_file_playback" parameter to play the video. In summary: - Changes Kodi makes to Python locale are ignored by explicitly using utf-8 for filenames. - Changes Kodi makes to Python filesystem encoding are ignored by writing the file as binary data. i.e. video file is not a text format so encoding is not an issue. - Filenames and paths are passed to Kodi functions are utf-8 encoded bytes. Extra notes: - Python os functions accept either bytes or unicode strings: return type matches input type. - Everything in the OS is bytes (eg. filenames), so use bytes as input to os functions. - Not all bytes have valid unicode representations when decoded from utf-8. - Since the underlying bytes can possibly be invalid, error handling is required.. The surrogateescape error mode represents the invalid utf-8 bytes as reserved unicode code points. It is the only error mode in python that provides lossless handling of the invalid utf-8 bytes. e.g. b"\xff" == b"\xff".decode("utf-8", "surrogateescape").encode("utf-8", "surrogateescape") - Many Kodi functions can accept either python unicode strings or utf-8 bytestrings, but they don't accept python unicode strings containing reserved code points (i.e. unprintable utf-8 decoded using surrogateescape error handler.) |