1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-16 14:34:31 +01:00

Use non-greedy regexps, for safety.

Since I was very lazy when I coded this, I took the fastest route.  Luckily,
Vasyl' Vavrychuk pointed this out and I went (after many months) and just
did some minor changes.
This commit is contained in:
Rogério Brito 2011-01-29 04:13:54 -02:00
parent 92743d423a
commit c5a088d341

View File

@ -1765,21 +1765,21 @@ class VimeoIE(InfoExtractor):
# Extract uploader and title from webpage # Extract uploader and title from webpage
self.report_extraction(video_id) self.report_extraction(video_id)
mobj = re.search(r'<caption>(.*)</caption>', webpage) mobj = re.search(r'<caption>(.*?)</caption>', webpage)
if mobj is None: if mobj is None:
self._downloader.trouble(u'ERROR: unable to extract video title') self._downloader.trouble(u'ERROR: unable to extract video title')
return return
video_title = mobj.group(1).decode('utf-8') video_title = mobj.group(1).decode('utf-8')
simple_title = re.sub(ur'(?u)([^%s]+)' % simple_title_chars, ur'_', video_title) simple_title = re.sub(ur'(?u)([^%s]+)' % simple_title_chars, ur'_', video_title)
mobj = re.search(r'<uploader_url>http://vimeo.com/(.*)</uploader_url>', webpage) mobj = re.search(r'<uploader_url>http://vimeo.com/(.*?)</uploader_url>', webpage)
if mobj is None: if mobj is None:
self._downloader.trouble(u'ERROR: unable to extract video uploader') self._downloader.trouble(u'ERROR: unable to extract video uploader')
return return
video_uploader = mobj.group(1).decode('utf-8') video_uploader = mobj.group(1).decode('utf-8')
# Extract video thumbnail # Extract video thumbnail
mobj = re.search(r'<thumbnail>(.*)</thumbnail>', webpage) mobj = re.search(r'<thumbnail>(.*?)</thumbnail>', webpage)
if mobj is None: if mobj is None:
self._downloader.trouble(u'ERROR: unable to extract video thumbnail') self._downloader.trouble(u'ERROR: unable to extract video thumbnail')
return return
@ -1795,14 +1795,14 @@ class VimeoIE(InfoExtractor):
video_description = 'Foo.' video_description = 'Foo.'
# Extract request signature # Extract request signature
mobj = re.search(r'<request_signature>(.*)</request_signature>', webpage) mobj = re.search(r'<request_signature>(.*?)</request_signature>', webpage)
if mobj is None: if mobj is None:
self._downloader.trouble(u'ERROR: unable to extract request signature') self._downloader.trouble(u'ERROR: unable to extract request signature')
return return
sig = mobj.group(1).decode('utf-8') sig = mobj.group(1).decode('utf-8')
# Extract request signature expiration # Extract request signature expiration
mobj = re.search(r'<request_signature_expires>(.*)</request_signature_expires>', webpage) mobj = re.search(r'<request_signature_expires>(.*?)</request_signature_expires>', webpage)
if mobj is None: if mobj is None:
self._downloader.trouble(u'ERROR: unable to extract request signature expiration') self._downloader.trouble(u'ERROR: unable to extract request signature expiration')
return return