BlipTVUserIE fix

This commit is contained in:
Filippo Valsorda 2012-08-01 21:11:04 +02:00
parent 818282710b
commit 11a141dec9
1 changed files with 8 additions and 8 deletions

View File

@ -1618,7 +1618,7 @@ class BlipTVUserIE(InfoExtractor):
"""Information Extractor for blip.tv users.""" """Information Extractor for blip.tv users."""
_VALID_URL = r'(?:(?:(?:https?://)?(?:\w+\.)?blip\.tv/)|bliptvuser:)([^/]+)/*$' _VALID_URL = r'(?:(?:(?:https?://)?(?:\w+\.)?blip\.tv/)|bliptvuser:)([^/]+)/*$'
_PAGE_SIZE = 10 _PAGE_SIZE = 12
IE_NAME = u'blip.tv:user' IE_NAME = u'blip.tv:user'
def __init__(self, downloader=None): def __init__(self, downloader=None):
@ -1638,31 +1638,31 @@ class BlipTVUserIE(InfoExtractor):
username = mobj.group(1) username = mobj.group(1)
page_base = None page_base = 'http://m.blip.tv/pr/show_get_full_episode_list?users_id=%s&lite=0&esi=1'
request = urllib2.Request(url) request = urllib2.Request(url)
try: try:
page = urllib2.urlopen(request).read().decode('utf-8') page = urllib2.urlopen(request).read().decode('utf-8')
mobj = re.search(r'data-source-url="([^"]+)"', page) mobj = re.search(r'data-users-id="([^"]+)"', page)
page_base = "http://blip.tv" + unescapeHTML(mobj.group(1)) page_base = page_base % mobj.group(1)
except (urllib2.URLError, httplib.HTTPException, socket.error), err: except (urllib2.URLError, httplib.HTTPException, socket.error), err:
self._downloader.trouble(u'ERROR: unable to download webpage: %s' % str(err)) self._downloader.trouble(u'ERROR: unable to download webpage: %s' % str(err))
return return
# Download video ids using BlipTV Page API. Result size per # Download video ids using BlipTV Ajax calls. Result size per
# query is limited (currently to 10 videos) so we need to query # query is limited (currently to 12 videos) so we need to query
# page by page until there are no video ids - it means we got # page by page until there are no video ids - it means we got
# all of them. # all of them.
video_ids = [] video_ids = []
pagenum = 0 pagenum = 1
while True: while True:
self.report_download_page(username, pagenum) self.report_download_page(username, pagenum)
request = urllib2.Request( page_base + "&page=" + str(pagenum+1) ) request = urllib2.Request( page_base + "&page=" + str(pagenum) )
try: try:
page = urllib2.urlopen(request).read().decode('utf-8') page = urllib2.urlopen(request).read().decode('utf-8')