News for hackers. Stuff that matters.
Re:Youtube-dl by sarreph on Sunday November 23, 2014 @05:42AM (#8648385)
You don't need to, as far as I'm aware. I think you can just request a supported URL, and it will download it automagically.
Re:Youtube-dl by pyre on Sunday November 23, 2014 @09:42AM (#8648889)
Correct. Each class that handles information extraction for a different side defines a regexp to match the url against. (Note: Some of the regexps aren't hardy to the http-vs-https distinction, so you might have to remove the 's')
Re:Youtube-dl by unicornporn on Sunday November 23, 2014 @11:09AM (#8649078)
Awesome, thanks. Should have tried before asking. :) Searched my system drive for these .py files, but found nothing, so I figured something was missing.
Re:Youtube-dl by pyre on Monday November 24, 2014 @12:08AM (#8651135)
All of the modules are compiled into a single file for the youtube-dl command. I've never looked into what they are using to do this, but you could poke your head into the repo to check it out.
Re:Youtube-dl by phihag_ on Monday November 24, 2014 @04:55AM (#8651670)
We're simply making use of Python's ability to load a module from a zip file [0]. Therefore, the generation[1] is just zipping up all the files and prepending a shebang.

[0] http://bugs.python.org/issue1739468 [1] https://github.com/rg3/youtube-dl/blob/640743233389714dda8a3...

Re:Youtube-dl by pyre on Monday November 24, 2014 @10:46AM (#8652866)
This:

  youtube-dl: youtube_dl/*.py youtube_dl/*/*.py
  	zip --quiet youtube-dl youtube_dl/*.py youtube_dl/*/*.py
  	zip --quiet --junk-paths youtube-dl youtube_dl/__main__.py
  	echo '#!$(PYTHON)' > youtube-dl
  	cat youtube-dl.zip >> youtube-dl
  	rm youtube-dl.zip
  	chmod a+x youtube-dl
Might be less confusing if you append '.zip' in the first two commands:

  	zip --quiet youtube-dl.zip youtube_dl/*.py youtube_dl/*/*.py
  	zip --quiet --junk-paths youtube-dl.zip youtube_dl/__main__.py

When you echo the shebang overwriting the file, I was thrown off. I'm thinking, "Why did you just zip all those contents into the file to just throw them out?" Then I see the `cat` line, and it makes sense that the `zip` command appends the .zip to the end of the file.