X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fustream.py;h=f69b27d4405d719e9c8d87807d2c1392753150eb;hb=74ac9bdd82b8a625ea9782251258ab7da1463877;hp=16cdcc76592feb03ad9b30b962e66041eb391168;hpb=bfd5c93af9f9eee938c628f19c997f999f21c74e;p=youtube-dl diff --git a/youtube_dl/extractor/ustream.py b/youtube_dl/extractor/ustream.py index 16cdcc765..f69b27d44 100644 --- a/youtube_dl/extractor/ustream.py +++ b/youtube_dl/extractor/ustream.py @@ -1,9 +1,11 @@ -from HTMLParser import HTMLParser import json import re -from urlparse import urljoin from .common import InfoExtractor +from ..utils import ( + compat_urlparse, + compat_html_parser, +) class UstreamIE(InfoExtractor): @@ -49,7 +51,7 @@ class UstreamIE(InfoExtractor): # More robust than regular expressions -class ChannelParser(HTMLParser): +class ChannelParser(compat_html_parser.HTMLParser): """ """ @@ -65,13 +67,13 @@ class ChannelParser(HTMLParser): if value.isdigit(): self.channel_id = value -class SocialstreamParser(HTMLParser): +class SocialstreamParser(compat_html_parser.HTMLParser): """
  • """ def __init__(self): - HTMLParser.__init__(self) + compat_html_parser.HTMLParser.__init__(self) self.content_ids = [] def handle_starttag(self, tag, attrs): @@ -88,8 +90,6 @@ class UstreamChannelIE(InfoExtractor): def _real_extract(self, url): m = re.match(self._VALID_URL, url) slug = m.group('slug') - # Slugs can be non-ascii, but youtube-dl can't handle non-ascii command lines, - # so if we got this far it's probably percent encoded and we needn't worry. p = ChannelParser() p.feed(self._download_webpage(url, slug)) @@ -100,16 +100,12 @@ class UstreamChannelIE(InfoExtractor): BASE = 'http://www.ustream.tv' next_url = '/ajax/socialstream/videos/%s/1.json' % channel_id while next_url: - reply = json.loads(self._download_webpage(urljoin(BASE, next_url), channel_id)) + reply = json.loads(self._download_webpage(compat_urlparse.urljoin(BASE, next_url), channel_id)) p.feed(reply['data']) next_url = reply['nextUrl'] p.close() video_ids = p.content_ids - # From YoutubeChannelIE - - self._downloader.to_screen(u'[ustream] Channel %s: Found %i videos' % (channel_id, len(video_ids))) - urls = ['http://www.ustream.tv/recorded/' + vid for vid in video_ids] url_entries = [self.url_result(eurl, 'Ustream') for eurl in urls] - return [self.playlist_result(url_entries, channel_id)] + return self.playlist_result(url_entries, channel_id)