[beeg] Extract all formats

This commit is contained in:
Sergey M․ 2014-09-02 20:54:00 +07:00
parent 1bf8cf5c2c
commit 3baa62e8d1

View file

@ -27,8 +27,16 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
video_url = self._html_search_regex( quality_arr = self._search_regex(
r"'480p'\s*:\s*'([^']+)'", webpage, 'video URL') r'(?s)var\s+qualityArr\s*=\s*{\s*(.+?)\s*}', webpage, 'quality formats')
formats = [{
'url': fmt[1],
'format_id': fmt[0],
'height': int(fmt[0][:-1]),
} for fmt in re.findall(r"'([^']+)'\s*:\s*'([^']+)'", quality_arr)]
self._sort_formats(formats)
title = self._html_search_regex( title = self._html_search_regex(
r'<title>([^<]+)\s*-\s*beeg\.?</title>', webpage, 'title') r'<title>([^<]+)\s*-\s*beeg\.?</title>', webpage, 'title')
@ -48,10 +56,10 @@ def _real_extract(self, url):
return { return {
'id': video_id, 'id': video_id,
'url': video_url,
'title': title, 'title': title,
'description': description, 'description': description,
'thumbnail': thumbnail, 'thumbnail': thumbnail,
'categories': categories, 'categories': categories,
'formats': formats,
'age_limit': 18, 'age_limit': 18,
} }