-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
YT-DLP support #36
Comments
+1 as this would also solve the buffering throttle issue (see https://code.videolan.org/videolan/vlc/-/issues/26174#note_286445). Currently no YouTube Video coming from send to Kodi is watchable for me as buffering always stops the playback. |
I did a quick local prototype and it worked perfectly (without buffering or any other issues):
from yt_dlp import YoutubeDL |
should i provide 2 addons with different YoutubeDL versions? one vanilla and one for yt_dlp? |
At this point yt_dlp has proven to be a stable fork but yt_dl is not completely dead yet. IMHO, I would simply include both in one addon version (this bloats "just" another 13 MB) and let the user decide via kodi addon settings:
if xbmcplugin.getSetting("use_legacy_yt_dl"):
from youtube_dl import YoutubeDL
else:
from yt_dlp import YoutubeDL This could make the maintaining a bit easier and the user experience better (lets be honest, must of us just want things to work and not dig in to this discussion here and figure out that we need to manually install another version of this plugin so their youtube videos play without constant buffering). Also I am not quite sure how your App works but I think another addon version would need to either have the same name (which would require a different repo or checking that not vanilla and the other version is installed) OR changes to you app so it detects a version with a different name (This was the case with the python3 version right?) |
I agree with nullket here. It would be nice to simply package both yt_dl and yt_dlp in the same plugin. |
thats a very nice idea thx @nullket. i also need to migrate my travis ci script to github actions, since travis was shut down for free use. currently the addon is not re-building at all. |
I can try to provide a pull request. Let me look into it |
i fixed the ci build. if someone is providing a pull-request for the python code (to extend it as @nullket proposed) i would in return extend the ci job to also package the yt-dlp fork |
Hey @firsttris whats your opinion on including youtube-dl/dlp both as git submodules with defined commits stating their version instead of having the github action pull the newest commit? The benefits would be:
Both repo folders - added as submodules - take about 8 MB of space each. The python import in the Just an idea. Interested in your opinion. |
hey @nullket i think thats an interesting idea to consider, which would make the CI script alot easier and cleaner. never worked with git submodules but my understanding is that is like a reference to the other repo. |
Yes that is correct. They are gits in the main repo where the main repo simply saves which commit number the submodule should be. Adding one
Want to upgrade a specific submodule to its latest commit?
Pitfall: New clone of the main repo or having an old clone
I created a PR if you agree on switching but the workflow is not testable for me, see #37 |
good work, i merged your PR and it worked like a charm. i also simplified the build-script.sh, it was a bit redundant. now the script is parameterized. |
Perfect :) Yep, your changes to the build script make totally sense. One could even split building and releasing into two steps (or one step with an argument to the script) so new PRs (and maybe even forks) could build a zip file (stored as a GitHub workflow artifacts) and one could easily test those „addons“ before merging. But I feel like I am over-engineering the process here a bit, based on how not so often you get PRs (I am currently just hyped poking around the Kodi Python api for the first time) |
the main idea is that the pipeline is autonomous releasing new versions based on a scheduler. wihtout human interference. |
still missing a pull-request to change service.py to either import youtube-dl or yt-dlp based on the kodi settings (as @nullket proposed), before we can close this issue. |
Actually the ytdl mega thread about YouTube throttling is writing patches on a daily basis now and seems to lean towards pulling the dlp changes to fix that. If I understood correctly. What other benefits will ytdlp have? |
They are writing patches but they do not seem to be merged. Looks like the maintainers are quite busy. Apart from YouTube this can be seen for other sources as well (broken downloader, wrong quality etc.). YouTube-dl is fine, it is just too often outdated. Ignoring all the other features we do not need, the amount of updates ytdlp gets is its biggest advantage. To sum it up: both should be available and let the SendToKodi users choose in case they prefer one more than the other. I would just say that the default one should always be that one that works (the most). |
I haven't checked out ytdlp, but updates sounds good. |
Can you please make yt-dlp the default resolver or at least offer a way to select between yt-dlp and (the now obsolete) youtube-dl? The throttling in youtube videos makes the use of sendtokodi a bad experience. |
@nullket how far are we with choosing resolver? |
We needed to sort out some things in repo/release structure first. Those bigger changes were made just last week and we wanted to see if the automatic building and releasing pipeline works before we mix up two major changes. But you are right. I am currently a bit busy at work (important deadline ahead) but I hope get this done by next week. Actually I have it is already working but the settings are dangled (missing strings in the menu) and we need a solution to support youtube-dl for the old python2 users. It would be awesome to detect if the script is executed on python2 (easy) and than change the kodi setting to youtube-dl (
I don't know how invidious is working. And I would guess that youtube-dl simply transforms invidious urls to youtube urls. I mean in the end it is the same backend and thus the same api. |
You are right about that detail for python2. However, sendtokodi's behavior is the same on either kodi 19 (main pc running debian testing/unstable and python 3 for the last ~1 year) or kodi 18 (old laptop running libreelec 9.2.6 and old tvbox running coreelec 9.2.8). About that last part about invidious, you are right.
|
Yes but youtube-dlp is actually python3 only. So after enabling youtube-dlp (by default) the addon would be simply broken for python2 users. |
You are right again :(
|
I have an idea I would like to share and it has to do with youtube videos only. |
Those would be quite a few things to do and it would kill the universal approach of this addon in a way. But what I like about it that it solves the problem for python2 users and also enables youtube in a higher quality (as the youtube addon uses adaptive stream and sendtokodi does not). @firsttris should this be added to the roadmap? Could be integrated as an optional setting ("play youtube videos in the youtube addon") in addtion to the youtube-dlp resolver? |
no i'm against that. our addon will only do one thing and try to be good at it. thats our usecase. i dont want to create a egg-laying woolly milk sow my understandig is with dlp we will solve the throtteling issue. but the focus of youtube_dl is not just youtube, its a multi site resolver/parser. |
also as @nullket mentioned any client can just send a request to plugin://plugin.video.youtube/play/?video_id=$VIDEOID there would be no need to change this addon. i remember our IOS App had such an option but i think we removed it at some point? kore for android maybe has such an option as well? i would also approve to change the chrome extension with such an option: |
About that. This will never happen. Youtube-dl has not been updated for 6+ months now and there is even this sticky in their reddit that devs encourage people to move to yt-dlp. There are also similar discussions about it on reddit and on their github. Moreover, apps that used youtube-dl as their backend for downloading (clipgrab, media downloader etc) or playback (mpv etc) have now moved to yt-dlp. As for me, I have to admit that I moved to sendtokodi from a similar addon that uses either resolveurl or script.module.youtube.dl (plugin.video.playthis by anxdpanic) because its "version" (or way of implementaion) of youtube-dl simply works better for many sites. |
I like this (Unix philosophy)
I like this even more :D
Totally agree that would be a good place where this would need to go! I have no idea of app programming and it is closed source anyways but maybe one day you have the time and the mood to implement this. Until then I would say that youtube-dlp solves the problems for now. I am working on it! |
It has all the appearance of being present in the iOS app from where I'm standing. Every supported add-on is listed in the app? |
So, a new version of youtube-dl was released today... The changelog does not mention anything about the throttling issue and most comments on reddit prove it was not fixed. |
Interesting. Do you know if anyone gave a specific reason? It's interesting to know how projects come to stagnate. |
Sorry, hit the wrong button there 🙂 Github design team still excelling at button placement. |
This is the pull request for youtube-dl that fixes the throttling issue on youtube. It seems it will not be merged in upstream youtube-dl anytime soon. Can you patch the relevant file in your addon so as to finally get rid of that annoyance? |
i think we could switch to his branch it seems he continously pulls in fixes, maybe it will be better then the official repo for the time beeing. till the situation changes. what do you other guys think? we just need to change this line to pull from this branch: |
If it works with python2, I am ok with it. I just hope his fork does not get too many bugs. |
Merry Christmas to everyone. |
We could indeed but we would need to trust the author (not so much because of bugs but due to our auto update process we also created a possibility to smuggle in arbitrary code). But he is quite active on the youtube-dl repo and I think we should simply swap the git url as you proposed. Also, I have created a new version of sendtokodi which uses youtube-dlp as default in kodi v19+ and should use youtube-dl on python2 systems. @pitsi and others: I would love to get some beta feedback on this version. Download and installation instructions can be found in the last paragraph of this comment. |
Please be patient :)
---edit
It installed with no issue though. I am off to test it. ---re-edit |
Yep that was on me. I zipped with the files belonging to a non default user. I corrected the zip but you figured out how to repair it as well :) |
And it works as it should on kodi 19. It using yt-dlp because I see no throttling.
---edit |
@nullket pushed plugin.video.sendtokodi-0.9.28.zip which now includes yt-dlp as default resolver for python3 version, python2 still uses youtube-dl. there is also a addon-settings to switch the resolver. |
Is this version any different than 1.0b1 I tested a few days ago? I wanto to remove it and install the one from the repo so as to get updates automatically. |
Yes and no. It is just different in terms of a newer yt-dlp version but that one brought some important improvements for youtube. I recommend to uninstall the beta and revert to the release of our repo instead. I will close the issue as the initial support has been provided. In case of problems, feature request, etc. feel free to open another issue (or even report back here). |
About that. As it seems, the patch has been merged in dirkf's fork of youtube-dl. However, the throttling is still there. I want to troubleshoot it a bit more, so as to know if the problem is on kodi itself. Ideally, I want to run it as a plain executable on my pc and see what happens. |
He did not merge it but he created the patch himself within the fork. That is the usual git(hub) contribution way: When you want to contribute, you fork a project, create a new branch within this fork, do your work and create a pull request to the master/main branch of the original repo.
Sure. We still use the official youtube-dl version which is still broken. Nobody changed to dirkf's fork and his PR is not merged (thus the official version still being broken). Now you might ask why we have not simply changed to dirks branch. The answer is quite easy: We have an automatic update process going on. So whenever dirk would add something to his branch a new sendtokodi addon version would be created. This sounds good so far. But this could also be very easy be exploited to bring potentially harmful code to all the python2 users using this plugin. This mechanism was fine for youtube-dl because it was a well reviewed repo. I am not saying dirk can not be trusted but it is simply not that easy. We could simply switch to his fork but imho a better way would be to patch youtube-dl ourselves (using dirks work by e.g. forking his fork under our namespace). @firsttris what do you think? In the end it is your project? An alternative is sending urls directly to the youtube addon from the app instead (like it was at some point?)
The problem is not within kodi the problem is that youtube-dl is still broken. While the problem is solved for python3 users it simply remains for those who have not upgraded yet. I don't know your system and of course the choice is totally yours but it might be less a hassle to just update kodi (or your whole OS if you use something like libreELEC) to kodi v19+.
The whole thing is basically just python. There is no need for a binary as long as you have a python interpreter installed on your computer.
In my opinion you should simply upgrade to a newer kodi version. |
I do not remember how to multiquote on github, so excuse me for the following. I did not know that the original youtube-dl is still used. I thought you switched to the fork and that the noumerous (almost daily) releases of sendtokodi are because of the new pathes that the fork gets. About testing his fork. I thought I had to build something. Anyway, I cloned his repo and the branch that (supposedly) contains the patch (df-youtube-unthrottle-patch), run youtube-dl to download something and the throttling is still there
As for the why I do not upgrade to a newer version of kodi. I have 5 devices that run kodi. Excluding my pc that runs kodi 19.3 under debian unstable x64, the remaining 4 all run *elec 9.2.x ones with kodi 18.9. These are
I will upgrade the laptop to libreelec 10 once I sort out some playback issues it has on kodi 19. The os will be installed from scratch and it will have to be reconfigured from scratch, so it is a lot of time to dedicate to it. |
The suggestion is one part - someone doing it in their free time the other ;)
That is actually all the updates and new features for youtube-dlp
Out of curiosity I tried it myself and it works just fine. I assume whatever you were running was not the actual patched version.
Anyways, at this point I would say we have spammed all others here in this issue enough with notification emails. Feel free to open a seperate youtube-dl legacy issue or even a PR with a solution. |
I am not an expert in git commands like you, so I downloaded the zip file from this branch here, extracted it to a folder, switched to the bin folder and then run youtube-dl from there. Last offtopic of the day, sorry. |
I have provided a workaround for python2 which was published just now. So all you need to do is to update the addon. In case of problems/comments please open a new issue. |
Could you please consider this fork since youtube_dl maintenance is very slow and this one envelopes youtube_dl anyways
https://github.com/yt-dlp/yt-dlp
The text was updated successfully, but these errors were encountered: