Skip to content
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

How to download the most popular playlist? #4148

Open
kenorb opened this issue Nov 10, 2014 · 9 comments
Open

How to download the most popular playlist? #4148

kenorb opened this issue Nov 10, 2014 · 9 comments

Comments

@kenorb
Copy link

@kenorb kenorb commented Nov 10, 2014

So far I've tried suggestion from here, but without success. Is there any way of downloading the playlist by most popular (e.g. top 10)?

@clampak
Copy link

@clampak clampak commented Nov 11, 2014

I added an answer to the stackexchange question. If you want just the top 10 from a playlist, you can just add --playlist-end 10 to the command line. Does that help, or are you asking something different?

@kenorb
Copy link
Author

@kenorb kenorb commented Nov 11, 2014

Thanks, it helps, but not for most popular.

The grid list of the page is sorted by popularity (e.g. here), but when you click on it, only the playlist sorted by the recent ones is loaded. In other words when clicking on the most popular video, on playlist it's shown as on xx position (not the 1st). So it seems like dynamic Popularity playlist doesn't exist at all. But it's achievable only by reading the grid from the page (videos?sort=p).

So testing from the command-line:

youtube-dl "https://www.youtube.com/user/Google/videos?sort=p" --playlist-end 5

and the first fetched video is Veterans Make Great Googlers (8ztbpW3THmI) which has around 300 view count, instead of 30m.

@clampak
Copy link

@clampak clampak commented Nov 12, 2014

You're right, that's strange. I checked on that for a few different usernames, and it appears that despite returning the correct order on the webpage, dynamically it always returns the newest-to-oldest order.
You can also generate an rss playlist sorted by popularity, but youtube rss feed support youtube-dl is apparently broken at the moment. See #2491.

@timss
Copy link

@timss timss commented Nov 16, 2014

I've been troubled with the same problem. Kind of annoying when you're trying to scrape the most popular videos from a channel and there is no ordered playlist available.

Please report back if any solution surfaces.

@kenorb
Copy link
Author

@kenorb kenorb commented May 11, 2015

Some workaround using curl:

URL="https://www.youtube.com/user/google/videos?sort=p"
videos=$(curl -s "$URL" | grep -o '/watch?v=[^"]*' | while read line; do echo "http://www.youtube.com$line"; done | uniq)
youtube-dl $videos

However it'll download the videos only from the 1st page.

@AnnanFay
Copy link

@AnnanFay AnnanFay commented Sep 6, 2016

Is this still an issue?

I just realised I want this feature - google leads here.

I had a quick look - it seems like any simple change to the code would break the fix for #5778. If you download uploads as a playlist you can't sort them. The relevant code is near ./youtube_dl/extractor/youtube.py:2043

@lord-carlos
Copy link

@lord-carlos lord-carlos commented Mar 17, 2019

This seems still to be an issue.
Any work around? The script from @kenorb only gives the first 30 results.

Edit: A, found a workaround. In the Channel view I found a autogenerated playlist, presset "play all" and gave the link to youtube-dl with --yes-playlist parameter. It now downlaods the top 200 songs.

@milahu
Copy link

@milahu milahu commented Aug 7, 2019

Edit: A, found a workaround. In the Channel view I found a autogenerated playlist, presset "play all" and gave the link to youtube-dl with --yes-playlist parameter. It now downlaods the top 200 songs.

edit, now i found it too ^^

channel ----> home ----> popular uploads ----> play all

copy the link and run

xclip -selection clipboard -o \
| xargs youtube-dl --yes-playlist --playlist-end 200

bash grammar narcissm ....

Some workaround using curl

as bash script in one pipe:

#!/bin/bash

echo "$@" \
| xargs curl -s \
| grep -o '/watch?v=[^"]*' \
| sed 's|^|https://www.youtube.com|' \
| uniq \
| xargs youtube-dl

[ i also added https ]

but yes, this will only load the first page

to get more than 200 "most popular" tracks ....

pagination for "filtered lists" is available
either via google api key
or by "sniff and fake" the youtube ajax traffic

.... or load more results in the browser
select wanted links
right click, run "copy selected links" [browser plugin]
and run

#!/bin/bash

xclip -selection clipboard -o \
| xargs youtube-dl
@ginhiki
Copy link

@ginhiki ginhiki commented Dec 2, 2019

So I need to download thumbnails for all the popular videos of a particular channel and when i try this method, youtube-dl gets stuck
this is the input
<
youtube-dl -v --skip-download --write-thumbnail --yes-playlist --playlist-end 10 -o "/home/red/hss/kids/pinkfong/%(view_count)s-%(like_count)s-%(dislike_count)s" https://www.youtube.com/watch?v=PRSoRkM8GcM&list=PUes1EvRjcKU4sY_UEavndBw

and i get output as
<
[3] 6672
[red@red ~]$ [debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '--skip-download', '--write-thumbnail', '--yes-playlist', '--playlist-end', '10', '-o', '/home/red/hss/kids/pinkfong/%(view_count)s-%(like_count)s-%(dislike_count)s', 'https://www.youtube.com/watch?v=PRSoRkM8GcM']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2019.11.28
[debug] Python version 3.8.0 (CPython) - Linux-5.3.13-arch1-1-x86_64-with-glibc2.2.5
[debug] exe versions: ffmpeg 4.2.1, ffprobe 4.2.1, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] PRSoRkM8GcM: Downloading webpage
[youtube] PRSoRkM8GcM: Downloading video info webpage
[debug] Default format spec: bestvideo+bestaudio/best
[youtube] PRSoRkM8GcM: Downloading thumbnail ...
[youtube] PRSoRkM8GcM: Writing thumbnail to: /home/red/hss/kids/pinkfong/27524118-467915-19078.jpg

it gets stuck in the same position after this with no other thumbnails being downloaded
Am i doing some mistake, can you please help me out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants
You can’t perform that action at this time.