Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Simple YouTube Downloader
9 points by 3xblah 60 days ago | hide | past | web | favorite | 6 comments
test $# -gt 0||exec echo usage: echo youtube-url\|$0 fmt \[saveas\];b=$(exec sed 's/http:/https:/; s/m.youtube/www.youtube/;s/youtu.be./www.youtube.com\/watch?v=/;s/hooktube.com/youtube.com/;s/embed./watch?v=/;#etc.;s/?version.//;s/;.//;');echo source url: $b;c=${b##=};a=$(ftp -4o/dev/stdout $b|exec grep -o "https%3A%2F%2Fr[0-9][a-zA-Z0-9.%_-]*"|exec sed 's/%26/\&/g;s/%3D/=/g;s/%3A/:/g;s/%2F/\//g;s/%3F/?/g;s/%25/%/g;/itag='"$1"'/!d');echo video url: $a;exec ftp -4o ${2-$c} $a;



1) Couldn't get it to work

2) An explination would be much appreciated

3) You probably want to format this as code (https://news.ycombinator.com/formatdoc)

4) Difference between this and youtube-dl? other than doing it without any dependencies.


1) What did you try?

2) It is a shell script

3) Sorry about that

4)

(a) It is smaller, simpler and faster.

(b) When YouTube occasionally makes a change I can fix it immediately rather than waiting for someone else to fix youtube-dl


It is probably my incompetence and arrogance. I am not that proficient in the unix shell yet. I was trying to run the entire thing from the command line, but also tried a couple of putting it in a function names `youtube-url` without success. I was stubborn and trying to use it like that `youtube-url fmt "https://you..."` and never got what you wrote in the usage section because I had `youtube-url` twice in the output (so I was never actually piping the url to that command)

But now after you said "script", I tried putting it in its own fine giving it an honest read/try. Figured out you are using netbsd, as Ubuntu's (and by definition Debian) `ftp` doesn't have an `-o` option. After deleting the o now I get

  source url: https://www.youtube.com/watch?v=CneL0GoZ3tk
  video url:
  ftp: https://www.youtube.com/watch?v=CneL0GoZ3tk: Name or service not known
> When YouTube occasionally makes a change I can fix it immediately rather than waiting for someone else to fix youtube-dl

I hear you. Had to download manually the latest ytdl development versions before they were packaged before.

EDIT: know what, you don't have to waste much time on me as it looks like there 'might' be more differences with grep/sed (who am I to know) I should not be here nor on my command line wasting time anyway. Have a ton of work to do to graduate on time.


Tested on Linux. ftp package is called tnftp. You can substitute curl -4o, wget -4O, fetch -4o or whatever client you prefer for downloading files.


That blob of bash output is not what i'd consider simple...


I would not consider it simple either. However, the word "simple" was not used. The word was used was "simpler".

The source for youtube-dl is not what I'd consider "simple". While neither solution is "simple", one may be "simpler" than the other.

Also, it is ash, not bash.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: