+ age_limit = int_or_none(self._search_regex(
+ r'you confirm that you are ([0-9]+) years and over.',
+ webpage, 'age limit', default=None))
+
+ sources_raw = self._search_regex(
+ r'(?s)sources:\s*(\[.*?\]),', webpage, 'video URLs', default=None)
+ if sources_raw is None:
+ alt_source = self._search_regex(
+ r'(file: ".*?"),', webpage, 'video URL', default=None)
+ if alt_source:
+ sources_raw = '[{ %s}]' % alt_source
+ else:
+ # Maybe an embed?
+ embed_url = self._search_regex(
+ r'<iframe[^>]+src="(http://www.prochan.com/embed\?[^"]+)"',
+ webpage, 'embed URL')
+ return {
+ '_type': 'url_transparent',
+ 'url': embed_url,
+ 'id': video_id,
+ 'title': video_title,
+ 'description': video_description,
+ 'uploader': video_uploader,
+ 'age_limit': age_limit,
+ }
+
+ sources_json = re.sub(r'\s([a-z]+):\s', r'"\1": ', sources_raw)
+ sources = json.loads(sources_json)
+
+ formats = [{
+ 'format_note': s.get('label'),
+ 'url': s['file'],
+ } for s in sources]
+ self._sort_formats(formats)