Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
98f3da4040
1 changed files with 8 additions and 7 deletions
|
@ -1018,8 +1018,7 @@ class YoutubeUserIE(InfoExtractor):
|
||||||
_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
|
||||||
_GDATA_URL = 'http://gdata.youtube.com/feeds/api/users/%s/uploads?max-results=%d&start-index=%d'
|
_GDATA_URL = 'http://gdata.youtube.com/feeds/api/users/%s/uploads?max-results=%d&start-index=%d&alt=json'
|
||||||
_VIDEO_INDICATOR = r'/watch\?v=(.+?)[\<&]'
|
|
||||||
IE_NAME = u'youtube:user'
|
IE_NAME = u'youtube:user'
|
||||||
|
|
||||||
def suitable(cls, url):
|
def suitable(cls, url):
|
||||||
|
@ -1048,13 +1047,15 @@ class YoutubeUserIE(InfoExtractor):
|
||||||
page = self._download_webpage(gdata_url, username,
|
page = self._download_webpage(gdata_url, username,
|
||||||
u'Downloading video ids from %d to %d' % (start_index, start_index + self._GDATA_PAGE_SIZE))
|
u'Downloading video ids from %d to %d' % (start_index, start_index + self._GDATA_PAGE_SIZE))
|
||||||
|
|
||||||
|
try:
|
||||||
|
response = json.loads(page)
|
||||||
|
except ValueError as err:
|
||||||
|
raise ExtractorError(u'Invalid JSON in API response: ' + compat_str(err))
|
||||||
|
|
||||||
# Extract video identifiers
|
# Extract video identifiers
|
||||||
ids_in_page = []
|
ids_in_page = []
|
||||||
|
for entry in response['feed']['entry']:
|
||||||
for mobj in re.finditer(self._VIDEO_INDICATOR, page):
|
ids_in_page.append(entry['id']['$t'].split('/')[-1])
|
||||||
if mobj.group(1) not in ids_in_page:
|
|
||||||
ids_in_page.append(mobj.group(1))
|
|
||||||
|
|
||||||
video_ids.extend(ids_in_page)
|
video_ids.extend(ids_in_page)
|
||||||
|
|
||||||
# A little optimization - if current page is not
|
# A little optimization - if current page is not
|
||||||
|
|
Loading…
Reference in a new issue