Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
youtube: fetch urls linked in playlists
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
avx
Advocate
Advocate


Joined: 21 Jun 2004
Posts: 2152

PostPosted: Thu Apr 28, 2011 3:38 pm    Post subject: youtube: fetch urls linked in playlists Reply with quote

Wanted to download all videos in a playlist on youtube, couldn't find a simple app for that, wrote a short script, works for me, so here it goes:

Either grab: http://phorcix.org/proj/yt/ytdlpl

or c&p
Code:
#!/bin/zsh
dump_prog="lynx"
dump_opts="-dump -listonly"

ytdlpl_this() {
    list=$1
    urls=${HOME}/ytdlpl.$list
    links=`${dump_prog} ${dump_opts} \
        "http://www.youtube.com/view_play_list?p=${list}" | \
        awk '/watch\?v/ {print $2}' | uniq >> ${urls}`
}
 
for pls in $@ ; do ytdlpl_this $pls:t ; done
This version depends on zsh(:t -> basename for bash), lynx and awk.

This creates a list of urls, which you can fetch with your prefered yt-grabber. In my case, that would be[code]cclive < $list[/url]

I'm working on a version being able to get all URLs from a user/channel, but I don't have a clue about JS, which YT uses to "load more". If someone could/would help me with that, that'd be nice.

Either way, use or ignore :)
_________________
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Back to top
View user's profile Send private message
aoeuaoue
n00b
n00b


Joined: 26 Feb 2010
Posts: 31

PostPosted: Tue May 31, 2011 6:18 pm    Post subject: or you could use youtube-dl Reply with quote

Dunno what your script does but there's an app in portage that does that automatically, when the link is a playlist.

net-misc/youtube-dl

Quote:
Usage: youtube-dl [options] url...

Options:
-h, --help print this help text and exit
-v, --version print program version and exit
-U, --update update this program to latest stable version
-i, --ignore-errors continue on download errors
-r LIMIT, --rate-limit=LIMIT
download rate limit (e.g. 50k or 44.6m)
-R RETRIES, --retries=RETRIES
number of retries (default is 10)
--playlist-start=NUMBER
playlist video to start at (default is 1)
--playlist-end=NUMBER
playlist video to end at (default is last)

--dump-user-agent display the current browser identification

Authentication Options:
-u USERNAME, --username=USERNAME
account username
-p PASSWORD, --password=PASSWORD
account password
-n, --netrc use .netrc authentication data

Video Format Options:
-f FORMAT, --format=FORMAT
video format code
--all-formats download all available video formats
--max-quality=FORMAT
highest quality format to download

Verbosity / Simulation Options:
-q, --quiet activates quiet mode
-s, --simulate do not download video
-g, --get-url simulate, quiet but print URL
-e, --get-title simulate, quiet but print title
--get-thumbnail simulate, quiet but print thumbnail URL
--get-description simulate, quiet but print video description
--get-filename simulate, quiet but print output filename
--no-progress do not print progress bar
--console-title display progress in console titlebar

Filesystem Options:
-t, --title use title in file name
-l, --literal use literal title in file name
-A, --auto-number number downloaded files starting from 00000
-o TEMPLATE, --output=TEMPLATE
output filename template
-a FILE, --batch-file=FILE
file containing URLs to download ('-' for stdin)
-w, --no-overwrites
do not overwrite files
-c, --continue resume partially downloaded files
--cookies=FILE file to dump cookie jar to
--no-part do not use .part files
--no-mtime do not use the Last-modified header to set the file
modification time


There are also other apps that I haven't tried:

kde-misc/youtube-servicemenu
media-video/minitube
net-misc/clipgrab
net-misc/yaydl
Back to top
View user's profile Send private message
avx
Advocate
Advocate


Joined: 21 Jun 2004
Posts: 2152

PostPosted: Tue May 31, 2011 7:36 pm    Post subject: Reply with quote

Thanks, didn't know them and they didn't turn up on google, I'll see if they are ok for me.
_________________
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum