mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-22 16:57:40 +00:00
Add --list-extractor-descriptions (human-readable list of IEs)
This commit is contained in:
parent
2db67bc0f4
commit
0f81866329
9 changed files with 34 additions and 22 deletions
|
@ -35,6 +35,7 @@ import codecs
|
||||||
import getpass
|
import getpass
|
||||||
import optparse
|
import optparse
|
||||||
import os
|
import os
|
||||||
|
import random
|
||||||
import re
|
import re
|
||||||
import shlex
|
import shlex
|
||||||
import socket
|
import socket
|
||||||
|
@ -142,6 +143,9 @@ def parseOpts(overrideArguments=None):
|
||||||
general.add_option('--list-extractors',
|
general.add_option('--list-extractors',
|
||||||
action='store_true', dest='list_extractors',
|
action='store_true', dest='list_extractors',
|
||||||
help='List all supported extractors and the URLs they would handle', default=False)
|
help='List all supported extractors and the URLs they would handle', default=False)
|
||||||
|
general.add_option('--list-extractor-descriptions',
|
||||||
|
action='store_true', dest='list_extractor_descriptions',
|
||||||
|
help='Output descriptions of all supported extractors', default=False)
|
||||||
general.add_option('--proxy', dest='proxy', default=None, help='Use the specified HTTP/HTTPS proxy', metavar='URL')
|
general.add_option('--proxy', dest='proxy', default=None, help='Use the specified HTTP/HTTPS proxy', metavar='URL')
|
||||||
general.add_option('--no-check-certificate', action='store_true', dest='no_check_certificate', default=False, help='Suppress HTTPS certificate validation.')
|
general.add_option('--no-check-certificate', action='store_true', dest='no_check_certificate', default=False, help='Suppress HTTPS certificate validation.')
|
||||||
|
|
||||||
|
@ -427,6 +431,18 @@ def _real_main(argv=None):
|
||||||
for mu in matchedUrls:
|
for mu in matchedUrls:
|
||||||
compat_print(u' ' + mu)
|
compat_print(u' ' + mu)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
if opts.list_extractor_descriptions:
|
||||||
|
for ie in sorted(extractors, key=lambda ie: ie.IE_NAME.lower()):
|
||||||
|
if not ie._WORKING:
|
||||||
|
continue
|
||||||
|
desc = getattr(ie, 'IE_DESC', ie.IE_NAME)
|
||||||
|
if hasattr(ie, 'SEARCH_KEY'):
|
||||||
|
_SEARCHES = (u'cute kittens', u'slithering pythons', u'falling cat', u'angry poodle', u'purple fish', u'running tortoise')
|
||||||
|
_COUNTS = (u'', u'5', u'10', u'all')
|
||||||
|
desc += u' (Example: "%s%s:%s" )' % (ie.SEARCH_KEY, random.choice(_COUNTS), random.choice(_SEARCHES))
|
||||||
|
compat_print(desc)
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
# Conflicting, missing and erroneous options
|
# Conflicting, missing and erroneous options
|
||||||
if opts.usenetrc and (opts.username is not None or opts.password is not None):
|
if opts.usenetrc and (opts.username is not None or opts.password is not None):
|
||||||
|
|
|
@ -12,8 +12,7 @@ from ..utils import (
|
||||||
|
|
||||||
|
|
||||||
class ComedyCentralIE(InfoExtractor):
|
class ComedyCentralIE(InfoExtractor):
|
||||||
"""Information extractor for The Daily Show and Colbert Report """
|
IE_DESC = u'The Daily Show / Colbert Report'
|
||||||
|
|
||||||
# urls can be abbreviations like :thedailyshow or :colbert
|
# urls can be abbreviations like :thedailyshow or :colbert
|
||||||
# urls for episodes like:
|
# urls for episodes like:
|
||||||
# or urls for clips like: http://www.thedailyshow.com/watch/mon-december-10-2012/any-given-gun-day
|
# or urls for clips like: http://www.thedailyshow.com/watch/mon-december-10-2012/any-given-gun-day
|
||||||
|
|
|
@ -263,3 +263,7 @@ class SearchInfoExtractor(InfoExtractor):
|
||||||
def _get_n_results(self, query, n):
|
def _get_n_results(self, query, n):
|
||||||
"""Get a specified number of results for a query"""
|
"""Get a specified number of results for a query"""
|
||||||
raise NotImplementedError("This method must be implemented by sublclasses")
|
raise NotImplementedError("This method must be implemented by sublclasses")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def SEARCH_KEY(self):
|
||||||
|
return self._SEARCH_KEY
|
||||||
|
|
|
@ -11,8 +11,7 @@ from ..utils import (
|
||||||
)
|
)
|
||||||
|
|
||||||
class GenericIE(InfoExtractor):
|
class GenericIE(InfoExtractor):
|
||||||
"""Generic last-resort information extractor."""
|
IE_DESC = u'Generic downloader that works on some sites'
|
||||||
|
|
||||||
_VALID_URL = r'.*'
|
_VALID_URL = r'.*'
|
||||||
IE_NAME = u'generic'
|
IE_NAME = u'generic'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
|
|
|
@ -10,8 +10,7 @@ from ..utils import (
|
||||||
|
|
||||||
|
|
||||||
class GooglePlusIE(InfoExtractor):
|
class GooglePlusIE(InfoExtractor):
|
||||||
"""Information extractor for plus.google.com."""
|
IE_DESC = u'Google Plus'
|
||||||
|
|
||||||
_VALID_URL = r'(?:https://)?plus\.google\.com/(?:[^/]+/)*?posts/(\w+)'
|
_VALID_URL = r'(?:https://)?plus\.google\.com/(?:[^/]+/)*?posts/(\w+)'
|
||||||
IE_NAME = u'plus.google'
|
IE_NAME = u'plus.google'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
|
|
|
@ -8,7 +8,7 @@ from ..utils import (
|
||||||
|
|
||||||
|
|
||||||
class GoogleSearchIE(SearchInfoExtractor):
|
class GoogleSearchIE(SearchInfoExtractor):
|
||||||
"""Information Extractor for Google Video search queries."""
|
IE_DESC = u'Google Video search'
|
||||||
_MORE_PAGES_INDICATOR = r'id="pnnext" class="pn"'
|
_MORE_PAGES_INDICATOR = r'id="pnnext" class="pn"'
|
||||||
_MAX_RESULTS = 1000
|
_MAX_RESULTS = 1000
|
||||||
IE_NAME = u'video.google:search'
|
IE_NAME = u'video.google:search'
|
||||||
|
|
|
@ -16,10 +16,9 @@ from ..utils import (
|
||||||
|
|
||||||
|
|
||||||
class StanfordOpenClassroomIE(InfoExtractor):
|
class StanfordOpenClassroomIE(InfoExtractor):
|
||||||
"""Information extractor for Stanford's Open ClassRoom"""
|
|
||||||
|
|
||||||
_VALID_URL = r'^(?:https?://)?openclassroom.stanford.edu(?P<path>/?|(/MainFolder/(?:HomePage|CoursePage|VideoPage)\.php([?]course=(?P<course>[^&]+)(&video=(?P<video>[^&]+))?(&.*)?)?))$'
|
|
||||||
IE_NAME = u'stanfordoc'
|
IE_NAME = u'stanfordoc'
|
||||||
|
IE_DESC = u'Stanford Open ClassRoom'
|
||||||
|
_VALID_URL = r'^(?:https?://)?openclassroom.stanford.edu(?P<path>/?|(/MainFolder/(?:HomePage|CoursePage|VideoPage)\.php([?]course=(?P<course>[^&]+)(&video=(?P<video>[^&]+))?(&.*)?)?))$'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://openclassroom.stanford.edu/MainFolder/VideoPage.php?course=PracticalUnix&video=intro-environment&speed=100',
|
u'url': u'http://openclassroom.stanford.edu/MainFolder/VideoPage.php?course=PracticalUnix&video=intro-environment&speed=100',
|
||||||
u'file': u'PracticalUnix_intro-environment.mp4',
|
u'file': u'PracticalUnix_intro-environment.mp4',
|
||||||
|
|
|
@ -11,7 +11,7 @@ from ..utils import (
|
||||||
)
|
)
|
||||||
|
|
||||||
class YahooIE(InfoExtractor):
|
class YahooIE(InfoExtractor):
|
||||||
"""Information extractor for screen.yahoo.com."""
|
IE_DESC = u'Yahoo screen'
|
||||||
_VALID_URL = r'http://screen\.yahoo\.com/.*?-(?P<id>\d*?)\.html'
|
_VALID_URL = r'http://screen\.yahoo\.com/.*?-(?P<id>\d*?)\.html'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://screen.yahoo.com/julian-smith-travis-legg-watch-214727115.html',
|
u'url': u'http://screen.yahoo.com/julian-smith-travis-legg-watch-214727115.html',
|
||||||
|
@ -88,8 +88,7 @@ class YahooIE(InfoExtractor):
|
||||||
return info_dict
|
return info_dict
|
||||||
|
|
||||||
class YahooSearchIE(SearchInfoExtractor):
|
class YahooSearchIE(SearchInfoExtractor):
|
||||||
"""Information Extractor for Yahoo! Video search queries."""
|
IE_DESC = u'Yahoo screen search'
|
||||||
|
|
||||||
_MAX_RESULTS = 1000
|
_MAX_RESULTS = 1000
|
||||||
IE_NAME = u'screen.yahoo:search'
|
IE_NAME = u'screen.yahoo:search'
|
||||||
_SEARCH_KEY = 'yvsearch'
|
_SEARCH_KEY = 'yvsearch'
|
||||||
|
|
|
@ -23,8 +23,7 @@ from ..utils import (
|
||||||
|
|
||||||
|
|
||||||
class YoutubeIE(InfoExtractor):
|
class YoutubeIE(InfoExtractor):
|
||||||
"""Information extractor for youtube.com."""
|
IE_DESC = u'YouTube.com'
|
||||||
|
|
||||||
_VALID_URL = r"""^
|
_VALID_URL = r"""^
|
||||||
(
|
(
|
||||||
(?:https?://)? # http(s):// (optional)
|
(?:https?://)? # http(s):// (optional)
|
||||||
|
@ -629,8 +628,7 @@ class YoutubeIE(InfoExtractor):
|
||||||
return results
|
return results
|
||||||
|
|
||||||
class YoutubePlaylistIE(InfoExtractor):
|
class YoutubePlaylistIE(InfoExtractor):
|
||||||
"""Information Extractor for YouTube playlists."""
|
IE_DESC = u'YouTube.com playlists'
|
||||||
|
|
||||||
_VALID_URL = r"""(?:
|
_VALID_URL = r"""(?:
|
||||||
(?:https?://)?
|
(?:https?://)?
|
||||||
(?:\w+\.)?
|
(?:\w+\.)?
|
||||||
|
@ -697,8 +695,7 @@ class YoutubePlaylistIE(InfoExtractor):
|
||||||
|
|
||||||
|
|
||||||
class YoutubeChannelIE(InfoExtractor):
|
class YoutubeChannelIE(InfoExtractor):
|
||||||
"""Information Extractor for YouTube channels."""
|
IE_DESC = u'YouTube.com channels'
|
||||||
|
|
||||||
_VALID_URL = r"^(?:https?://)?(?:youtu\.be|(?:\w+\.)?youtube(?:-nocookie)?\.com)/channel/([0-9A-Za-z_-]+)"
|
_VALID_URL = r"^(?:https?://)?(?:youtu\.be|(?:\w+\.)?youtube(?:-nocookie)?\.com)/channel/([0-9A-Za-z_-]+)"
|
||||||
_TEMPLATE_URL = 'http://www.youtube.com/channel/%s/videos?sort=da&flow=list&view=0&page=%s&gl=US&hl=en'
|
_TEMPLATE_URL = 'http://www.youtube.com/channel/%s/videos?sort=da&flow=list&view=0&page=%s&gl=US&hl=en'
|
||||||
_MORE_PAGES_INDICATOR = 'yt-uix-load-more'
|
_MORE_PAGES_INDICATOR = 'yt-uix-load-more'
|
||||||
|
@ -756,8 +753,7 @@ class YoutubeChannelIE(InfoExtractor):
|
||||||
|
|
||||||
|
|
||||||
class YoutubeUserIE(InfoExtractor):
|
class YoutubeUserIE(InfoExtractor):
|
||||||
"""Information Extractor for YouTube users."""
|
IE_DESC = u'YouTube.com user videos (URL or "ytuser" keyword)'
|
||||||
|
|
||||||
_VALID_URL = r'(?:(?:(?:https?://)?(?:\w+\.)?youtube\.com/user/)|ytuser:)([A-Za-z0-9_-]+)'
|
_VALID_URL = r'(?:(?:(?:https?://)?(?:\w+\.)?youtube\.com/user/)|ytuser:)([A-Za-z0-9_-]+)'
|
||||||
_TEMPLATE_URL = 'http://gdata.youtube.com/feeds/api/users/%s'
|
_TEMPLATE_URL = 'http://gdata.youtube.com/feeds/api/users/%s'
|
||||||
_GDATA_PAGE_SIZE = 50
|
_GDATA_PAGE_SIZE = 50
|
||||||
|
@ -813,7 +809,7 @@ class YoutubeUserIE(InfoExtractor):
|
||||||
return [self.playlist_result(url_results, playlist_title = username)]
|
return [self.playlist_result(url_results, playlist_title = username)]
|
||||||
|
|
||||||
class YoutubeSearchIE(SearchInfoExtractor):
|
class YoutubeSearchIE(SearchInfoExtractor):
|
||||||
"""Information Extractor for YouTube search queries."""
|
IE_DESC = u'YouTube.com searches'
|
||||||
_API_URL = 'https://gdata.youtube.com/feeds/api/videos?q=%s&start-index=%i&max-results=50&v=2&alt=jsonc'
|
_API_URL = 'https://gdata.youtube.com/feeds/api/videos?q=%s&start-index=%i&max-results=50&v=2&alt=jsonc'
|
||||||
_MAX_RESULTS = 1000
|
_MAX_RESULTS = 1000
|
||||||
IE_NAME = u'youtube:search'
|
IE_NAME = u'youtube:search'
|
||||||
|
@ -856,6 +852,7 @@ class YoutubeSearchIE(SearchInfoExtractor):
|
||||||
|
|
||||||
|
|
||||||
class YoutubeShowIE(InfoExtractor):
|
class YoutubeShowIE(InfoExtractor):
|
||||||
|
IE_DESC = u'YouTube.com (multi-season) shows'
|
||||||
_VALID_URL = r'https?://www\.youtube\.com/show/(.*)'
|
_VALID_URL = r'https?://www\.youtube\.com/show/(.*)'
|
||||||
IE_NAME = u'youtube:show'
|
IE_NAME = u'youtube:show'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue