1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-02 17:22:31 +01:00

VineIE: extract more information and minor style changes

This commit is contained in:
Jaime Marquínez Ferrándiz 2013-05-20 08:31:03 +02:00
parent 5b0d3cc0cd
commit 17bd1b2f41
2 changed files with 22 additions and 7 deletions

View File

@ -458,7 +458,8 @@
"file": "b9KOOWX7HUx.mp4", "file": "b9KOOWX7HUx.mp4",
"md5": "2f36fed6235b16da96ce9b4dc890940d", "md5": "2f36fed6235b16da96ce9b4dc890940d",
"info_dict":{ "info_dict":{
"title":"Chicken." "title": "Chicken.",
"uploader": "Jack Dorsey"
} }
} }
] ]

View File

@ -4116,21 +4116,35 @@ def _real_extract(self, url):
webpage_url = 'https://vine.co/v/' + video_id webpage_url = 'https://vine.co/v/' + video_id
webpage = self._download_webpage(webpage_url, video_id) webpage = self._download_webpage(webpage_url, video_id)
mobj = re.search(r'<meta property="twitter:player:stream" content="([^"]+)"', webpage) self.report_extraction(video_id)
mobj = re.search(r'<meta property="twitter:player:stream" content="(.+?)"', webpage)
if mobj is None: if mobj is None:
raise ExtractorError(u'Unable to extract video URL') raise ExtractorError(u'Unable to extract video URL')
video_url = mobj.group(1) video_url = mobj.group(1)
mobj = re.search(r'<meta property="og:title" content="([^"]+)"', webpage) mobj = re.search(r'<meta property="og:title" content="(.+?)"', webpage)
if mobj is None: if mobj is None:
raise ExtractorError(u'Unable to extract title') raise ExtractorError(u'Unable to extract title')
video_title = mobj.group(1) video_title = mobj.group(1)
mobj = re.search(r'<meta property="og:image" content="(.+?)(\?.*?)?"', webpage)
if mobj is None:
raise ExtractorError(u'Unable to extract thumbnail')
thumbnail = mobj.group(1)
mobj = re.search(r'<div class="user">.*?<h2>(.+?)</h2>', webpage, re.DOTALL)
if mobj is None:
raise ExtractorError(u'Unable to extract uploader')
uploader = mobj.group(1)
return [{ return [{
'id': video_id, 'id': video_id,
'url': video_url, 'url': video_url,
'ext': 'mp4', 'ext': 'mp4',
'title': video_title, 'title': video_title,
'thumbnail': thumbnail,
'uploader': uploader,
}] }]
def gen_extractors(): def gen_extractors():