"""Print msg to screen, prefixing it with '[ie_name]'"""
self._downloader.to_screen(u'[%s] %s' % (self.IE_NAME, msg))
+ def report_extraction(self, id_or_name):
+ """Report information extraction."""
+ self.to_screen(u'%s: Extracting information' % id_or_name)
+
+ def report_age_confirmation(self):
+ """Report attempt to confirm age."""
+ self.to_screen(u'Confirming age')
+
#Methods for following #608
#They set the correct value of the '_type' key
def video_result(self, video_info):
"""Report attempt to log in."""
self.to_screen(u'Logging in')
- def report_age_confirmation(self):
- """Report attempt to confirm age."""
- self.to_screen(u'Confirming age')
-
def report_video_webpage_download(self, video_id):
"""Report attempt to download video webpage."""
self.to_screen(u'%s: Downloading video webpage' % video_id)
format_list = available_formats
existing_formats = [x for x in format_list if x in url_map]
if len(existing_formats) == 0:
- self._downloader.report_error(u'no known formats available for video')
- return
+ raise ExtractorError(u'no known formats available for video')
if self._downloader.params.get('listformats', None):
self._print_formats(existing_formats)
return
video_url_list = [(rf, url_map[rf])]
break
if video_url_list is None:
- self._downloader.report_error(u'requested format not available')
- return
+ raise ExtractorError(u'requested format not available')
else:
- self._downloader.report_error(u'no conn or url_encoded_fmt_stream_map information found in video info')
- return
+ raise ExtractorError(u'no conn or url_encoded_fmt_stream_map information found in video info')
results = []
for format_param, video_real_url in video_url_list:
"""Report disclaimer retrieval."""
self.to_screen(u'Retrieving disclaimer')
- def report_age_confirmation(self):
- """Report attempt to confirm age."""
- self.to_screen(u'Confirming age')
-
def report_download_webpage(self, video_id):
"""Report webpage download."""
self.to_screen(u'%s: Downloading webpage' % video_id)
- def report_extraction(self, video_id):
- """Report information extraction."""
- self.to_screen(u'%s: Extracting information' % video_id)
-
def _real_initialize(self):
# Retrieve disclaimer
request = compat_urllib_request.Request(self._DISCLAIMER)
def __init__(self, downloader=None):
InfoExtractor.__init__(self, downloader)
- def report_extraction(self, video_id):
- """Report information extraction."""
- self.to_screen(u'%s: Extracting information' % video_id)
-
def _real_extract(self, url):
# Extract id and simplified title from URL
mobj = re.match(self._VALID_URL, url)
"""Report webpage download."""
self.to_screen(u'%s: Downloading webpage' % video_id)
- def report_extraction(self, video_id):
- """Report information extraction."""
- self.to_screen(u'%s: Extracting information' % video_id)
-
def _real_extract(self, url):
# Extract id from URL
mobj = re.match(self._VALID_URL, url)
"""Report webpage download."""
self.to_screen(u'%s: Downloading webpage' % video_id)
- def report_extraction(self, video_id):
- """Report information extraction."""
- self.to_screen(u'%s: Extracting information' % video_id)
-
def _real_extract(self, url, new_video=True):
# Extract ID from URL
mobj = re.match(self._VALID_URL, url)
"""Report webpage download."""
self.to_screen(u'%s: Downloading webpage' % video_id)
- def report_extraction(self, video_id):
- """Report information extraction."""
- self.to_screen(u'%s: Extracting information' % video_id)
-
def _real_extract(self, url, new_video=True):
# Extract ID from URL
mobj = re.match(self._VALID_URL, url)
"""Report webpage download."""
self.to_screen(u'%s: Downloading webpage' % video_id)
- def report_extraction(self, video_id):
- """Report information extraction."""
- self.to_screen(u'%s: Extracting information' % video_id)
-
def fetch_webpage(self, url):
request = compat_urllib_request.Request(url)
try:
self._downloader.report_warning(u'Falling back on generic information extractor.')
self.to_screen(u'%s: Downloading webpage' % video_id)
- def report_extraction(self, video_id):
- """Report information extraction."""
- self.to_screen(u'%s: Extracting information' % video_id)
-
def report_following_redirect(self, new_url):
"""Report information extraction."""
self._downloader.to_screen(u'[redirect] Following redirect to %s' % new_url)
"""Report webpage download."""
self.to_screen(u'%s: Downloading webpage' % file_id)
- def report_extraction(self, file_id):
- """Report information extraction."""
- self.to_screen(u'%s: Extracting information' % file_id)
-
def _real_extract(self, url):
file_id = url.split('/')[-1]
# Rebuild url in english locale
_URL_EXT = r'^.*\.([a-z0-9]+)$'
IE_NAME = u'blip.tv'
- def report_extraction(self, file_id):
- """Report information extraction."""
- self.to_screen(u'%s: Extracting information' % file_id)
-
def report_direct_download(self, title):
"""Report information extraction."""
self.to_screen(u'%s: Direct download detected' % title)
def __init__(self, downloader=None):
InfoExtractor.__init__(self, downloader)
- def report_extraction(self, video_id):
- """Report information extraction."""
- self.to_screen(u'%s: Extracting information' % video_id)
-
def _real_extract(self,url):
mobj = re.match(self._VALID_URL, url)
if mobj is None:
"""Receives a URL and returns True if suitable for this IE."""
return re.match(cls._VALID_URL, url, re.VERBOSE) is not None
- def report_extraction(self, episode_id):
- self.to_screen(u'%s: Extracting information' % episode_id)
-
def report_config_download(self, episode_id, media_id):
self.to_screen(u'%s: Downloading configuration for %s' % (episode_id, media_id))
_VALID_URL = r'^(https?://)?(www\.)?escapistmagazine\.com/videos/view/(?P<showname>[^/]+)/(?P<episode>[^/?]+)[/?]?.*$'
IE_NAME = u'escapist'
- def report_extraction(self, showName):
- self.to_screen(u'%s: Extracting information' % showName)
-
def report_config_download(self, showName):
self.to_screen(u'%s: Downloading configuration' % showName)
"""Report information extraction."""
self.to_screen(u'%s: Downloading XML manifest' % video_id)
- def report_extraction(self, video_id):
- """Report information extraction."""
- self.to_screen(u'%s: Extracting information' % video_id)
-
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
if mobj is None:
_VALID_URL = r'^(?:https?://)?(?:www\.)?xvideos\.com/video([0-9]+)(?:.*)'
IE_NAME = u'xvideos'
- def report_extraction(self, video_id):
- """Report information extraction."""
- self.to_screen(u'%s: Extracting information' % video_id)
-
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
if mobj is None:
"""Report information extraction."""
self.to_screen(u'%s: Resolving id' % video_id)
- def report_extraction(self, video_id):
- """Report information extraction."""
- self.to_screen(u'%s: Retrieving stream' % video_id)
-
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
if mobj is None:
"""Report information extraction."""
self.to_screen(u'%s: Resolving id' % video_id)
- def report_extraction(self, video_id):
- """Report information extraction."""
- self.to_screen(u'%s: Retrieving stream' % video_id)
-
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
if mobj is None:
"""Information extractor for infoq.com"""
_VALID_URL = r'^(?:https?://)?(?:www\.)?infoq\.com/[^/]+/[^/]+$'
- def report_extraction(self, video_id):
- """Report information extraction."""
- self.to_screen(u'%s: Extracting information' % video_id)
-
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
if mobj is None:
"""Report JSON download."""
self.to_screen(u'Downloading json')
- def report_extraction(self, file_id):
- """Report information extraction."""
- self.to_screen(u'%s: Extracting information' % file_id)
-
def get_urls(self, jsonData, fmt, bitrate='best'):
"""Get urls from 'audio_formats' section in json"""
file_url = None
"""Report information extraction."""
self.to_screen(u'%s: Downloading webpage' % objid)
- def report_extraction(self, video_id):
- """Report information extraction."""
- self.to_screen(u'%s: Extracting information' % video_id)
-
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
if mobj is None:
_VALID_URL = r'^(?P<proto>https?://)?(?:www\.)?mtv\.com/videos/[^/]+/(?P<videoid>[0-9]+)/[^/]+$'
IE_NAME = u'mtv'
- def report_extraction(self, video_id):
- """Report information extraction."""
- self.to_screen(u'%s: Extracting information' % video_id)
-
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
if mobj is None:
"""Report webpage download."""
self.to_screen(u'%s: Downloading webpage' % file_id)
- def report_extraction(self, file_id):
- """Report information extraction."""
- self.to_screen(u'%s: Extracting information' % file_id)
-
def _gen_sid(self):
nowTime = int(time.time() * 1000)
random1 = random.randint(1000,1998)
"""Report information extraction"""
self.to_screen(u'%s: Downloading webpage' % video_id)
- def report_extraction(self, video_id):
- """Report information extraction"""
- self.to_screen(u'%s: Extracting information' % video_id)
-
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
if mobj is None:
_JUSTIN_PAGE_LIMIT = 100
IE_NAME = u'justin.tv'
- def report_extraction(self, file_id):
- """Report information extraction."""
- self.to_screen(u'%s: Extracting information' % file_id)
-
def report_download_page(self, channel, offset):
"""Report attempt to download a single page of videos."""
self.to_screen(u'%s: Downloading video information from %d to %d' %
def _real_extract(self, url):
m = re.match(self._VALID_URL, url, re.VERBOSE)
- urlRE = r"'movie_(?P<videoID>\d+)': \{\s*FILENAME: \"(?P<videoURL>[\w:/\.\?=]+)\"(,\s*MOVIE_NAME: \"(?P<videoName>[\w:/\.\?=\+-]+)\")?\s*\},"
gameID = m.group('gameID')
- videourl = 'http://store.steampowered.com/video/%s/' % gameID
+ videourl = 'http://store.steampowered.com/agecheck/video/%s/?snr=1_agecheck_agecheck__age-gate&ageDay=1&ageMonth=January&ageYear=1970' % gameID
+ self.report_age_confirmation()
webpage = self._download_webpage(videourl, gameID)
+ game_title = re.search(r'<h2 class="pageheader">(?P<game_title>.*?)</h2>', webpage).group('game_title')
+
+ urlRE = r"'movie_(?P<videoID>\d+)': \{\s*FILENAME: \"(?P<videoURL>[\w:/\.\?=]+)\"(,\s*MOVIE_NAME: \"(?P<videoName>[\w:/\.\?=\+-]+)\")?\s*\},"
mweb = re.finditer(urlRE, webpage)
namesRE = r'<span class="title">(?P<videoName>.+?)</span>'
titles = re.finditer(namesRE, webpage)
'thumbnail': video_thumb
}
videos.append(info)
- return videos
+ return [self.playlist_result(videos, gameID, game_title)]
class UstreamIE(InfoExtractor):
_VALID_URL = r'https?://www\.ustream\.tv/recorded/(?P<videoID>\d+)'
info["url"] = stream["video_url"]
return [info]
+class TumblrIE(InfoExtractor):
+ _VALID_URL = r'http://(?P<blog_name>.*?).tumblr.com/((post)|(video))/(?P<id>\d*)/(.*?)'
+
+ def _real_extract(self, url):
+ m_url = re.match(self._VALID_URL, url)
+ video_id = m_url.group('id')
+ blog = m_url.group('blog_name')
+
+ url = 'http://%s.tumblr.com/post/%s/' % (blog, video_id)
+ webpage = self._download_webpage(url, video_id)
+
+ re_video = r'src=\\x22(?P<video_url>http://%s.tumblr.com/video_file/%s/(.*?))\\x22 type=\\x22video/(?P<ext>.*?)\\x22' % (blog, video_id)
+ video = re.search(re_video, webpage)
+ if video is None:
+ self.to_screen("No video founded")
+ return []
+ video_url = video.group('video_url')
+ ext = video.group('ext')
+
+ re_thumb = r'posters(.*?)\[\\x22(?P<thumb>.*?)\\x22' # We pick the first poster
+ thumb = re.search(re_thumb, webpage).group('thumb').replace('\\', '')
+
+ # The only place where you can get a title, it's not complete,
+ # but searching in other places doesn't work for all videos
+ re_title = r'<title>(.*?) - (?P<title>.*?)</title>'
+ title = unescapeHTML(re.search(re_title, webpage).group('title'))
+
+ return [{'id': video_id,
+ 'url': video_url,
+ 'title': title,
+ 'thumbnail': thumb,
+ 'ext': ext
+ }]
+
def gen_extractors():
""" Return a list of an instance of every supported extractor.
SpiegelIE(),
LiveLeakIE(),
ARDIE(),
+ TumblrIE(),
GenericIE()
]