top | item 18046413

Ytdl-webserver: Webserver for downloading YouTube videos

129 points| setra | 7 years ago |github.com | reply

66 comments

order
[+] bklaasen|7 years ago|reply
I use Android and have Termux[1] installed. If you create a shell script named '~/bin/termux-url-opener' and share URLs to Termux, it'll invoke that script. Here's the contents of mine:

``` #!/bin/bash

pip install --upgrade youtube-dl cd storage/movies youtube-dl "${1}" ```

Works a treat!

[1] Termux (Terminal emulator with packages) - https://f-droid.org/app/com.termux, https://play.google.com/store/apps/details?id=com.termux

[+] marmaduke|7 years ago|reply
On iOS I’ve installed Pythonista with Stash, pip installed YouTube-dL, set up a script to take a link and download it to mp4 and share it an app (usually VLC).

This can be triggered from YouTube app by pressing Share, then Pythonista script then the custom script, wait for download then select VLC.

It’s not great for big videos but was extremely satisfying to set up.

[+] m-p-3|7 years ago|reply
That's my workflow too, works well for many websites.

To watch I use NewPipe instead of the official YouTube client.

[+] cuchoi|7 years ago|reply
Made it work. Thanks!
[+] frou_dh|7 years ago|reply
It's not as slickly packaged, but I made a webserver that turns YouTube channels into proper RSS subscribe-able audio podcasts:

https://github.com/frou/yt2pod

If you find yourself often having your phone in your pocket with the screen blazing, just to be able to listen to YT content, you might like it.

(it's on the todo list to Dockerize it)

[+] ballenf|7 years ago|reply
Did you know iOS podcasts supports video podcasts? Haven’t looked at your code but maybe wouldn’t be too much work to make video work too. I’ll talk a look. Thanks!

I’ve thought that it would be a great way to avoid the algorithm addiction and only see my subs.

[+] stingraycharles|7 years ago|reply
In my experience, YouTube-dl needs to be updated quite frequently, as YouTube changes their design.

How is this handled here? Is periodically kill / restart the container enough?

[+] vram22|7 years ago|reply
I don't know if it applies to the web server, but for the command-line version of youtube-dl, it has a -U option that updates itself. One could create a batch file or shell script that runs that each time, before downloading a video, or do it manually once in a while. Like someone else said, I think the creator updates the app fairly often.

Edit: I had written a post about youtube-dl describing its use a bit, and also a quick look at its code:

youtube-dl, a YouTube downloader in Python:

https://jugad2.blogspot.com/2013/03/youtube-dl-yourube-downl...

Also check out: pafy - Python API for YouTube:

https://jugad2.blogspot.com/2014/06/pafy-python-api-for-yout...

Edit 2: And this might be of use:

How to download PyCon US 2013 videos for offline viewing using youtube-dl:

https://jugad2.blogspot.com/2013/04/how-to-download-pycon-us...

[+] markovbot|7 years ago|reply
It looks like they're installing youtube-dl via apt, from the Ubuntu 16.04 repos (which is what the docker image uses as a base), do even rebuilding wouldn't cut it. I wonder if this will even work out of the box, because YouTube changed something that required youtube-dl to fix a month or two ago.
[+] Spivak|7 years ago|reply
Same as how most containers update, rebuild a new version push and deploy.
[+] pishpash|7 years ago|reply
The more tools built around youtube-dl to make it usable by your grandma, the more likely it gets shut down, like Popcorn Time.
[+] jimktrains2|7 years ago|reply
I was just thinking the other day of writing a small utility to download a YouTube video and metadata, stuff the metadata in a database, and be able to have a local, searchable copy of videos and channels I'd like to have for a while -- I don't trust they'll be around forever.

I was thinking it could be better if the utility would be more useful if it integrated with mythtv, but I might start as a standalone.

[+] wongarsu|7 years ago|reply
Having a local, searchable version of some channels would be great, especially if it can be configured to download new videos automatically. Some channels are notorious for having videos deleted (e.g. commentary channels that have to fight with contentid or educational channels that have videos involving gunpowder or uranium). Manually backing them up and organizing the videos is very cumbersome.
[+] sondh|7 years ago|reply
Just yesterday I built an Android app to cast audio-only (ogg format) from YouTube to Chromecast. Had to do it because:

1. Baby needs her white noise to sleep

2. No other sites have those "8 hours womb sounds" as good as YouTube

3. The YouTube app refuses to cast to Google Home mini

Came across ydls[1] which uses youtube-dl and ffmpeg to download then transcode media on-the-fly. It's not very effective but works great! We no longer have to turn on the TV in our baby room. Check out the source code[2] if you are also a new parent.

1: https://github.com/wader/ydls

2: https://github.com/daohoangson/android-ydls

[+] explainplease|7 years ago|reply
Save the video's audio as a local file if you want to keep using it. Any YouTube video is bound to disappear without warning at any time.
[+] superasn|7 years ago|reply
Is there a way to download Netflix videos too? My reason is I just can't watch anything at less than 1.5X speed nowadays and Netflix has no such option on mobile (there is a chrome extension though). Any ideas how to do either (dl or increase playback speed on mobile)
[+] LMYahooTFY|7 years ago|reply
...you can't watch anything at less than 1.5x?

Is this something you've trained yourself to do...? Like deliberately?

[+] TingPing|7 years ago|reply
To my knowledge there isn't a way to bypass its DRM atm (to directly download a file).
[+] shasheene|7 years ago|reply
+1. The lack of 2x playback speed makes documentaries on Netflix unwatchable. Third-party Chrome extensions of unknown origin doesn't seem like a good idea.

Unfortunately, easier to stick to YouTube and VLC for documentary watching.

[+] severine|7 years ago|reply
You mean apart from the obvious?
[+] damm|7 years ago|reply
Meh; nodejs that uses youtube-dl frontend? why can't I just use youtube-dl?
[+] jnaina|7 years ago|reply
built a simple MacOS Safari extension that sends the current url to my server, which then runs a simple script to download using youtube-dl. I then use my iPad to view the videos using the nPlayer which can read NFS shares. very useful for downloading and viewing videos from variety of "alternate" video sites
[+] tlrobinson|7 years ago|reply
Does this download to the client or server? The latter would be useful on a NAS / Plex box.
[+] hgasimov|7 years ago|reply
Is downloading youtube videos legal?
[+] CraneWorm|7 years ago|reply
How could it not be? You "download" the stream every time you watch it. It's to everyone's benefit to cache it if you want to watch it more than once. That way you don't use that much bandwidth. You might be served less ads, but you shouldn't be watching them anyway.
[+] chungy|7 years ago|reply
Probably only on creative commons-licensed videos (there are some). Otherwise, it might be an unlawful replication.

And yes, there will be arguments about how you're just saving to a file what otherwise comes in via the player. I honestly don't know the definitive answer. :)

[+] naner|7 years ago|reply
Despite all the comments pretending this is all super ok scrapers are obviously not aboveboard. Sites may try to place limits on you or your account but it is unlikely you will go to court over a TOS violation unless you're really abusive.
[+] aaaaaaaaaab|7 years ago|reply
How would you watch them without downloading?
[+] grezql|7 years ago|reply
-deleted link- may be a DMCA violation