Merge branch 'master' of github.com:rg3/youtube-dl
This commit is contained in:
commit
9d93e7da6c
@ -46,7 +46,7 @@ class YahooIE(InfoExtractor):
|
|||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
items_json = self._search_regex(r'YVIDEO_INIT_ITEMS = ({.*?});$',
|
items_json = self._search_regex(r'mediaItems: ({.*?})$',
|
||||||
webpage, u'items', flags=re.MULTILINE)
|
webpage, u'items', flags=re.MULTILINE)
|
||||||
items = json.loads(items_json)
|
items = json.loads(items_json)
|
||||||
info = items['mediaItems']['query']['results']['mediaObj'][0]
|
info = items['mediaItems']['query']['results']['mediaObj'][0]
|
||||||
@ -91,17 +91,13 @@ class YahooIE(InfoExtractor):
|
|||||||
formats.append(format_info)
|
formats.append(format_info)
|
||||||
formats = sorted(formats, key=lambda f:(f['height'], f['width']))
|
formats = sorted(formats, key=lambda f:(f['height'], f['width']))
|
||||||
|
|
||||||
info = {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': meta['title'],
|
'title': meta['title'],
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'description': clean_html(meta['description']),
|
'description': clean_html(meta['description']),
|
||||||
'thumbnail': meta['thumbnail'],
|
'thumbnail': meta['thumbnail'],
|
||||||
}
|
}
|
||||||
# TODO: Remove when #980 has been merged
|
|
||||||
info.update(formats[-1])
|
|
||||||
|
|
||||||
return info
|
|
||||||
|
|
||||||
|
|
||||||
class YahooSearchIE(SearchInfoExtractor):
|
class YahooSearchIE(SearchInfoExtractor):
|
||||||
|
@ -1547,7 +1547,9 @@ class YoutubePlaylistIE(YoutubeBaseInfoExtractor):
|
|||||||
# the id of the playlist is just 'RD' + video_id
|
# the id of the playlist is just 'RD' + video_id
|
||||||
url = 'https://youtube.com/watch?v=%s&list=%s' % (playlist_id[2:], playlist_id)
|
url = 'https://youtube.com/watch?v=%s&list=%s' % (playlist_id[2:], playlist_id)
|
||||||
webpage = self._download_webpage(url, playlist_id, u'Downloading Youtube mix')
|
webpage = self._download_webpage(url, playlist_id, u'Downloading Youtube mix')
|
||||||
title = clean_html(get_element_by_attribute('class', 'title long-title', webpage))
|
title_span = (get_element_by_attribute('class', 'title long-title', webpage) or
|
||||||
|
get_element_by_attribute('class', 'title ', webpage))
|
||||||
|
title = clean_html(title_span)
|
||||||
video_re = r'data-index="\d+".*?href="/watch\?v=([0-9A-Za-z_-]{11})&[^"]*?list=%s' % re.escape(playlist_id)
|
video_re = r'data-index="\d+".*?href="/watch\?v=([0-9A-Za-z_-]{11})&[^"]*?list=%s' % re.escape(playlist_id)
|
||||||
ids = orderedSet(re.findall(video_re, webpage))
|
ids = orderedSet(re.findall(video_re, webpage))
|
||||||
url_results = self._ids_to_results(ids)
|
url_results = self._ids_to_results(ids)
|
||||||
@ -1789,7 +1791,6 @@ class YoutubeFeedsInfoExtractor(YoutubeBaseInfoExtractor):
|
|||||||
Subclasses must define the _FEED_NAME and _PLAYLIST_TITLE properties.
|
Subclasses must define the _FEED_NAME and _PLAYLIST_TITLE properties.
|
||||||
"""
|
"""
|
||||||
_LOGIN_REQUIRED = True
|
_LOGIN_REQUIRED = True
|
||||||
_PAGING_STEP = 30
|
|
||||||
# use action_load_personal_feed instead of action_load_system_feed
|
# use action_load_personal_feed instead of action_load_system_feed
|
||||||
_PERSONAL_FEED = False
|
_PERSONAL_FEED = False
|
||||||
|
|
||||||
@ -1809,9 +1810,8 @@ class YoutubeFeedsInfoExtractor(YoutubeBaseInfoExtractor):
|
|||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
feed_entries = []
|
feed_entries = []
|
||||||
# The step argument is available only in 2.7 or higher
|
paging = 0
|
||||||
for i in itertools.count(0):
|
for i in itertools.count(1):
|
||||||
paging = i*self._PAGING_STEP
|
|
||||||
info = self._download_webpage(self._FEED_TEMPLATE % paging,
|
info = self._download_webpage(self._FEED_TEMPLATE % paging,
|
||||||
u'%s feed' % self._FEED_NAME,
|
u'%s feed' % self._FEED_NAME,
|
||||||
u'Downloading page %s' % i)
|
u'Downloading page %s' % i)
|
||||||
@ -1824,6 +1824,7 @@ class YoutubeFeedsInfoExtractor(YoutubeBaseInfoExtractor):
|
|||||||
for video_id in ids)
|
for video_id in ids)
|
||||||
if info['paging'] is None:
|
if info['paging'] is None:
|
||||||
break
|
break
|
||||||
|
paging = info['paging']
|
||||||
return self.playlist_result(feed_entries, playlist_title=self._PLAYLIST_TITLE)
|
return self.playlist_result(feed_entries, playlist_title=self._PLAYLIST_TITLE)
|
||||||
|
|
||||||
class YoutubeSubscriptionsIE(YoutubeFeedsInfoExtractor):
|
class YoutubeSubscriptionsIE(YoutubeFeedsInfoExtractor):
|
||||||
@ -1843,7 +1844,6 @@ class YoutubeWatchLaterIE(YoutubeFeedsInfoExtractor):
|
|||||||
_VALID_URL = r'https?://www\.youtube\.com/feed/watch_later|:ytwatchlater'
|
_VALID_URL = r'https?://www\.youtube\.com/feed/watch_later|:ytwatchlater'
|
||||||
_FEED_NAME = 'watch_later'
|
_FEED_NAME = 'watch_later'
|
||||||
_PLAYLIST_TITLE = u'Youtube Watch Later'
|
_PLAYLIST_TITLE = u'Youtube Watch Later'
|
||||||
_PAGING_STEP = 100
|
|
||||||
_PERSONAL_FEED = True
|
_PERSONAL_FEED = True
|
||||||
|
|
||||||
class YoutubeHistoryIE(YoutubeFeedsInfoExtractor):
|
class YoutubeHistoryIE(YoutubeFeedsInfoExtractor):
|
||||||
@ -1853,13 +1853,6 @@ class YoutubeHistoryIE(YoutubeFeedsInfoExtractor):
|
|||||||
_PERSONAL_FEED = True
|
_PERSONAL_FEED = True
|
||||||
_PLAYLIST_TITLE = u'Youtube Watch History'
|
_PLAYLIST_TITLE = u'Youtube Watch History'
|
||||||
|
|
||||||
def _real_extract(self, url):
|
|
||||||
webpage = self._download_webpage('https://www.youtube.com/feed/history', u'History')
|
|
||||||
data_paging = self._search_regex(r'data-paging="(\d+)"', webpage, u'data-paging')
|
|
||||||
# The step is actually a ridiculously big number (like 1374343569725646)
|
|
||||||
self._PAGING_STEP = int(data_paging)
|
|
||||||
return super(YoutubeHistoryIE, self)._real_extract(url)
|
|
||||||
|
|
||||||
class YoutubeFavouritesIE(YoutubeBaseInfoExtractor):
|
class YoutubeFavouritesIE(YoutubeBaseInfoExtractor):
|
||||||
IE_NAME = u'youtube:favorites'
|
IE_NAME = u'youtube:favorites'
|
||||||
IE_DESC = u'YouTube.com favourite videos, "ytfav" keyword (requires authentication)'
|
IE_DESC = u'YouTube.com favourite videos, "ytfav" keyword (requires authentication)'
|
||||||
|
Loading…
Reference in New Issue
Block a user