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

Allow extra playlist format #482

Closed
littlesandra88 opened this issue Oct 21, 2012 · 17 comments
Closed

Allow extra playlist format #482

littlesandra88 opened this issue Oct 21, 2012 · 17 comments
Assignees

Comments

@littlesandra88
Copy link

@littlesandra88 littlesandra88 commented Oct 21, 2012

When browsing playlists from a user, the links looks like

http://www.youtube.com/watch?v=sao5-VCcRkQ&list=PLB34CE9AD7450F3A3

It would be great if I just could do

youtube-dl PLB34CE9AD7450F3A3

just like it can be done for videos.

Playlists always starts with PL and then 16 chars of [A-Z][0-9]

@Plaque-fcc
Copy link

@Plaque-fcc Plaque-fcc commented Oct 21, 2012

…not only at youTube can be placed a playlist. youtube-dl is a
versatile tool capable of fetching and processing media content from
various sources, bear this in mind, please. To make sure this case will
relate to youTube only, there must be implemented an obvious
command-line option to feed youtube-dl with. Think twice, although your
proposal is a tasty idea as it sounds.

В Sat, 20 Oct 2012 18:08:54 -0700
littlesandra88 notifications@github.com пишет:

When browsing playlists from a user, the links looks like

http://www.youtube.com/watch?v=sao5-VCcRkQ&list=PLB34CE9AD7450F3A3

It would be great if I just could do

youtube-dl PLB34CE9AD7450F3A3

just like it can be done for videos.

Playlists always starts with PL and then 16 chars of [A-Z][0-9]


Reply to this email directly or view it on GitHub:
#482

@Plaque-fcc
Copy link

@Plaque-fcc Plaque-fcc commented Oct 21, 2012

After a bit thinking.
Hey, it actually sounds like having a full DVD movie rip offline by calling something like dvd-restore --from-sha512 --shasum='cdfce681eadc7d88195b4df74bee4ad512e0bd08185614e745746cd51d0599174d0b341d7b5c6bb35698b593eb8628a7f1b1c9b2519c0b59316486eca9864d78' just because that DVD movie rip's SHA sum is cdfce681eadc7d88195b4df74bee4ad512e0bd08185614e745746cd51d0599174d0b341d7b5c6bb35698b593eb8628a7f1b1c9b2519c0b59316486eca9864d78. How would that hypothetic dvd-restore tool get the original info — who knows?

@Plaque-fcc
Copy link

@Plaque-fcc Plaque-fcc commented Oct 21, 2012

I mean, whenever you actually need this, you may use:

#!/bin/bash

plprefix='http://www.youtube.com/playlist?list='

[[ -z $1 ]] && echo 'Usage:' $0 'PLAYLIST-ID' && exit 1;

youtube-dl "$plprefix$1";

exit

One may save this in a file and name like youtube-pl, then call ./youtube-pl PLB34CE9AD7450F3A3 if you wish the thing you describe.

@Plaque-fcc
Copy link

@Plaque-fcc Plaque-fcc commented Oct 21, 2012

Of course, this is just the way of bash-wrappings around things you don't need to overcomplicate but want to adapt.
If at your side is a fresh MS Windows, you may use the power of its PowerShell (since as I have found it is a monkey of bash), thus you'll never have to change youtube-dl itself to teach it something not actually valuable, friend. ;D

@littlesandra88
Copy link
Author

@littlesandra88 littlesandra88 commented Oct 21, 2012

The bash script wrapper is an interesting wordaround, as I always have to look up what I have to prefix the playlist ID with.

I suppose that the regex would be PL[\dA-Z]{16} . Would this conflict with other regex's?

@Plaque-fcc
Copy link

@Plaque-fcc Plaque-fcc commented Oct 21, 2012

How and where do you intend to use this regex, dear?

And, by the way, doesn't the workaround work for you?

@littlesandra88
Copy link
Author

@littlesandra88 littlesandra88 commented Oct 21, 2012

To replace the regex that searches for youtube.com/playlist?list= with PL[\dA-Z]{16}. Or add it to the playlist detection, so it can support both cases?

Yes, the workaround worked, but I can't be the only one that have this problem, so it would be a great feature to have.

@Plaque-fcc
Copy link

@Plaque-fcc Plaque-fcc commented Oct 21, 2012

You may be not the one who ran into the problem. In my very childhood I
wished to have candy trees, and also the idea of having exactly what
you wrote in the beginning visited me some months ago. I was thinking I
even can implement such a thing with ease, I put my hands into the
script, also tuned it a bit, although never knew it from the inside,
and decided there is no sufficient need in having this.

Many people (as I can see) are troubled with youtube-dl and Python 2.5
or other similar problems, and for many of them is no adequate general
solution without having the script overcomplicated. Prove me wrong, if
you can.

@littlesandra88
Copy link
Author

@littlesandra88 littlesandra88 commented Oct 21, 2012

There are two sides to this:

  • code maintainability
  • features

and depending on who you are, you will prioritize them different. User / developer.

If the purpose of the program is to make the users lifes easier, then adding || /PL[\dA-Z]{16}/ to the existing if-statement is not a big deal.

@Plaque-fcc
Copy link

@Plaque-fcc Plaque-fcc commented Oct 21, 2012

I am an occasional user and kinda youtube-dl project fan. ;D

But if you want me to implement the functional you ask for, I could try to.
So, do you?

@Plaque-fcc
Copy link

@Plaque-fcc Plaque-fcc commented Oct 21, 2012

One question more: if youtube.com/playlist?list= works, what else would you like to regex-ly detect?
Recognition that youtube-ld PLXXXXXX means youtube-ld youtube.com/playlist?list=PLXXXXXX is straightforward, but do the conversion back is not so obvious for me in its purposes. Could you explain why?

@littlesandra88
Copy link
Author

@littlesandra88 littlesandra88 commented Oct 21, 2012

Can you reformulate that? I don't understand.

@Plaque-fcc
Copy link

@Plaque-fcc Plaque-fcc commented Oct 21, 2012

To replace the regex that searches for youtube.com/playlist?list= with PL[\dA-Z]{16}. Or add it to the playlist detection, so it can support both cases?

Which two cases? The one where it detects that there is a playlist is already implemented.

Smoking a long pipe, looking at

_VALID_URL = r'(?:https?://)?(?:\w+\.)?youtube\.com/(?:(?:course|view_play_list|my_playlists|artist|playlist)\?.*?(p|a|list)=|user/.*?/user/|p/|user/.*?#[pg]/c/)(?:PL|EC)?([0-9A-Za-z-_]+)(?:/.*?/([0-9A-Za-z_-]+))?.*'

It's in InfoExtractors.py:YoutubePlaylistIE.

The best way I could provide is not harming the original YoutubePlaylistIE but deriving a wrapper class. But this is quite less worhy than simply having a bash wrapper shown above.

@Plaque-fcc
Copy link

@Plaque-fcc Plaque-fcc commented Oct 21, 2012

And I doubt the authors will support this step.

Guessing what happens when youTube change their PL ID format that it will be confused with other content providers easily.

@FiloSottile
Copy link
Collaborator

@FiloSottile FiloSottile commented Oct 22, 2012

Nice to see so much discussion around a feature (keep the tones nice! :) )
Actually, we already do this with base YT video IDs, and as

  • playlists (almost) always start with PL or EL
  • we are developing youtube-dl, and a YT bias is intended

I would +1 on this, and here is a patch (ok, not pretty, as it repeats itself, but by far the easiest and most understandable)

diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py
index 88973cc..80d7339 100644
--- a/youtube_dl/InfoExtractors.py
+++ b/youtube_dl/InfoExtractors.py
@@ -1508,7 +1508,7 @@ class YahooSearchIE(InfoExtractor):
 class YoutubePlaylistIE(InfoExtractor):
        """Information Extractor for YouTube playlists."""

-       _VALID_URL = r'(?:https?://)?(?:\w+\.)?youtube\.com/(?:(?:course|view_play_list|my_playlists|artist|playlist)\?.*?(p|a|list)=|user/.*?/user/|p/|user/.*?#[pg]/c/)(?:PL|EC)?([0-9A-Za-z-_]+)(?:/.*?/([0-9A-Za-z_-]+))?.*'
+       _VALID_URL = r'(?:(?:https?://)?(?:\w+\.)?youtube\.com/(?:(?:course|view_play_list|my_playlists|artist|playlist)\?.*?(p|a|list)=|user/.*?/user/|p/|user/.*?#[pg]/c/)(?:PL|EC)?|PL|EC)([0-9A-Za-z-_]+)(?:/.*?/([0-9A-Za-z_-]+))?.*'
        _TEMPLATE_URL = 'http://www.youtube.com/%s?%s=%s&page=%s&gl=US&hl=en'
        _VIDEO_INDICATOR_TEMPLATE = r'/watch\?v=(.+?)&([^&"]+&)*list=.*?%s'
        _MORE_PAGES_INDICATOR = r'yt-uix-pager-next'

But, obviously, I will leave to @phihag the decision.

@ghost ghost assigned phihag Oct 22, 2012
@Plaque-fcc
Copy link

@Plaque-fcc Plaque-fcc commented Oct 22, 2012

I knew there'll be someone who knows these py/regex-es from the
inside. Beg your pardon if I wasn't polite. Already wanna test it. ^,^

@phihag phihag closed this in c6c0e23 Oct 22, 2012
@phihag
Copy link
Contributor

@phihag phihag commented Oct 22, 2012

I have yet to see an argument against supporting raw playlist IDs, so they're in the current dev build. We'll release soon, but you can already download the git version and either execute python -m youtube_dl or make (to create a new binary) in the meantime.

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
4 participants
You can’t perform that action at this time.