ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.92k stars 10.01k forks source link

When query youtube playlist, no title is returned #16284

Open quekky opened 6 years ago

quekky commented 6 years ago

Please follow the guide below


Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2018.04.25. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

Before submitting an issue make sure you have:

What is the purpose of your issue?


The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue


If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:

Add the -v flag to your command line you run youtube-dl with (youtube-dl -v <your command line>), copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):

# youtube-dl.exe -v -j --flat-playlist https://www.youtube.com/user/CNETTV/playlists
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '-j', '--flat-playlist', 'https://www.youtube.com/user/CNETTV/playlists']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2018.04.25
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.16299
[debug] exe versions: none
[debug] Proxy map: {}
{"ie_key": "YoutubePlaylist", "url": "https://www.youtube.com/playlist?list=LLOmcA3f_RrH6b9NmcNa4tdg", "_type": "url"}
{"ie_key": "YoutubePlaylist", "url": "https://www.youtube.com/playlist?list=PLAl4aZK3mRv2uEJBT-g9ZQ_FaHlqZ31km", "_type": "url"}
{"ie_key": "YoutubePlaylist", "url": "https://www.youtube.com/playlist?list=PLAl4aZK3mRv3GTTtuDv65IgCTaMRRGAJy", "_type": "url"}
{"ie_key": "YoutubePlaylist", "url": "https://www.youtube.com/playlist?list=PLAl4aZK3mRv2QGpN0f8rHN0IarEoSScoj", "_type": "url"}
{"ie_key": "YoutubePlaylist", "url": "https://www.youtube.com/playlist?list=PLAl4aZK3mRv3htKwUwGGC5I_npw1IHh5K", "_type": "url"}
{"ie_key": "YoutubePlaylist", "url": "https://www.youtube.com/playlist?list=PLAl4aZK3mRv3vtryjYuuGNFAk0A8IuWO6", "_type": "url"}
{"ie_key": "YoutubePlaylist", "url": "https://www.youtube.com/playlist?list=PLAl4aZK3mRv2WMwsuJOmW0rrNqtj7_ipK", "_type": "url"}
{"ie_key": "YoutubePlaylist", "url": "https://www.youtube.com/playlist?list=PLAl4aZK3mRv3wnjBRP3nXj05uTgeD5OXD", "_type": "url"}
{"ie_key": "YoutubePlaylist", "url": "https://www.youtube.com/playlist?list=PLAl4aZK3mRv1ErwrGUZpHKCY-RM25yLqz", "_type": "url"}
{"ie_key": "YoutubePlaylist", "url": "https://www.youtube.com/playlist?list=PLAl4aZK3mRv2BWtTpy-hLZn4Pd3IPjGPI", "_type": "url"}

<end of log>

If the purpose of this issue is a site support request please provide all kinds of example URLs support for which should be included (replace following example URLs by yours):

Note that youtube-dl does not support sites dedicated to copyright infringement. In order for site support request to be accepted all provided example URLs should not violate any copyrights.


Description of your issue, suggested solution and other information

Run the youtube-dl on a playlists to get a list of playlist (eg https://www.youtube.com/user/CNETTV/playlists ) it returns a list of playlist but there is no title returned on the playlist.

Expected result is to also print the titles of the playlist

Changing the following code will allow it to return the title

class YoutubePlaylistsBaseInfoExtractor(YoutubeEntryListBaseInfoExtractor):
    def _process_page(self, content):
        for playlist_id, video_title in orderedSet(re.findall(
                r'<h3[^>]+class="[^"]*yt-lockup-title[^"]*"[^>]*><a[^>]+href="/?playlist\?list=([0-9A-Za-z-_]{10,})"(?:[^>]+>(?P<title>[^<]+))?',
                content)):
            video_title = unescapeHTML(video_title)
            if video_title:
                video_title = video_title.strip()
            yield self.url_result(
                'https://www.youtube.com/playlist?list=%s' % playlist_id, 'YoutubePlaylist', video_title=video_title)

Expected result:

youtube-dl.exe -j --flat-playlist https://www.youtube.com/user/CNETTV/playlists
{"_type": "url", "url": "https://www.youtube.com/playlist?list=LLOmcA3f_RrH6b9NmcNa4tdg", "ie_key": "YoutubePlaylist", "title": "Liked videos"}
{"_type": "url", "url": "https://www.youtube.com/playlist?list=PLAl4aZK3mRv2uEJBT-g9ZQ_FaHlqZ31km", "ie_key": "YoutubePlaylist", "title": "So Retro"}
{"_type": "url", "url": "https://www.youtube.com/playlist?list=PLAl4aZK3mRv3GTTtuDv65IgCTaMRRGAJy", "ie_key": "YoutubePlaylist", "title": "Most popular videos this week"}
{"_type": "url", "url": "https://www.youtube.com/playlist?list=PLAl4aZK3mRv2QGpN0f8rHN0IarEoSScoj", "ie_key": "YoutubePlaylist", "title": "Quick Questions with Jeff Bakalar"}
{"_type": "url", "url": "https://www.youtube.com/playlist?list=PLAl4aZK3mRv3htKwUwGGC5I_npw1IHh5K", "ie_key": "YoutubePlaylist", "title": "CNET Book Club"}
{"_type": "url", "url": "https://www.youtube.com/playlist?list=PLAl4aZK3mRv3vtryjYuuGNFAk0A8IuWO6", "ie_key": "YoutubePlaylist", "title": "CNET Versus"}
{"_type": "url", "url": "https://www.youtube.com/playlist?list=PLAl4aZK3mRv2WMwsuJOmW0rrNqtj7_ipK", "ie_key": "YoutubePlaylist", "title": "Jeff Bakalar videos"}
{"_type": "url", "url": "https://www.youtube.com/playlist?list=PLAl4aZK3mRv3wnjBRP3nXj05uTgeD5OXD", "ie_key": "YoutubePlaylist", "title": "The Tesla Track"}
{"_type": "url", "url": "https://www.youtube.com/playlist?list=PLAl4aZK3mRv1ErwrGUZpHKCY-RM25yLqz", "ie_key": "YoutubePlaylist", "title": "CNET Torture Tests"}
{"_type": "url", "url": "https://www.youtube.com/playlist?list=PLAl4aZK3mRv2BWtTpy-hLZn4Pd3IPjGPI", "ie_key": "YoutubePlaylist", "title": "CNET Live Events 2018"}
joe-bruno commented 6 years ago

16352

motiv8d commented 4 years ago

Thankyou @quekky - I have just tried making the suggested patch and it works. For others, the file change is to "/usr/lib/python3.8/site-packages/youtube_dl/extractor/youtube.py" (path may vary dependent on your system and python revisions).

As this seems like trivial issue fix and it was made over 2 years ago now, I do not understand why this is not implemented in the official versions.

The only problem I still have with this function is it is limited to returning 14 entries. That is a separate issue of course.

Can someone advise why this patch has not been implemented please?