mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-23 00:54:31 +01:00
Fix metacafe.com and UTF8 output filenames
This commit is contained in:
parent
0ddf38df18
commit
2546e7679f
11
youtube-dl
11
youtube-dl
@ -4,6 +4,7 @@
|
|||||||
# License: Public domain code
|
# License: Public domain code
|
||||||
import htmlentitydefs
|
import htmlentitydefs
|
||||||
import httplib
|
import httplib
|
||||||
|
import locale
|
||||||
import math
|
import math
|
||||||
import netrc
|
import netrc
|
||||||
import os
|
import os
|
||||||
@ -592,7 +593,7 @@ class MetacafeIE(InfoExtractor):
|
|||||||
"""Information Extractor for metacafe.com."""
|
"""Information Extractor for metacafe.com."""
|
||||||
|
|
||||||
_VALID_URL = r'(?:http://)?(?:www\.)?metacafe\.com/watch/([^/]+)/([^/]+)/.*'
|
_VALID_URL = r'(?:http://)?(?:www\.)?metacafe\.com/watch/([^/]+)/([^/]+)/.*'
|
||||||
_DISCLAIMER = 'http://www.metacafe.com/disclaimer'
|
_DISCLAIMER = 'http://www.metacafe.com/family_filter/'
|
||||||
_youtube_ie = None
|
_youtube_ie = None
|
||||||
|
|
||||||
def __init__(self, youtube_ie, downloader=None):
|
def __init__(self, youtube_ie, downloader=None):
|
||||||
@ -631,10 +632,10 @@ class MetacafeIE(InfoExtractor):
|
|||||||
|
|
||||||
# Confirm age
|
# Confirm age
|
||||||
disclaimer_form = {
|
disclaimer_form = {
|
||||||
'allowAdultContent': '1',
|
'filters': '0',
|
||||||
'submit': "Continue - I'm over 18",
|
'submit': "Continue - I'm over 18",
|
||||||
}
|
}
|
||||||
request = urllib2.Request('http://www.metacafe.com/watch/', urllib.urlencode(disclaimer_form), std_headers)
|
request = urllib2.Request('http://www.metacafe.com/', urllib.urlencode(disclaimer_form), std_headers)
|
||||||
try:
|
try:
|
||||||
self.report_age_confirmation()
|
self.report_age_confirmation()
|
||||||
disclaimer = urllib2.urlopen(request).read()
|
disclaimer = urllib2.urlopen(request).read()
|
||||||
@ -684,7 +685,7 @@ class MetacafeIE(InfoExtractor):
|
|||||||
|
|
||||||
video_url = '%s?__gda__=%s' % (mediaURL, gdaKey)
|
video_url = '%s?__gda__=%s' % (mediaURL, gdaKey)
|
||||||
|
|
||||||
mobj = re.search(r'(?im)<meta name="title" content="Metacafe - ([^"]+)"', webpage)
|
mobj = re.search(r'(?im)<title>(.*) - Video</title>', webpage)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
self.to_stderr(u'ERROR: unable to extract title')
|
self.to_stderr(u'ERROR: unable to extract title')
|
||||||
return [None]
|
return [None]
|
||||||
@ -909,7 +910,7 @@ if __name__ == '__main__':
|
|||||||
'forcetitle': opts.gettitle,
|
'forcetitle': opts.gettitle,
|
||||||
'simulate': (opts.simulate or opts.geturl or opts.gettitle),
|
'simulate': (opts.simulate or opts.geturl or opts.gettitle),
|
||||||
'format': opts.format,
|
'format': opts.format,
|
||||||
'outtmpl': ((opts.outtmpl is not None and opts.outtmpl.decode())
|
'outtmpl': ((opts.outtmpl is not None and opts.outtmpl.decode(locale.getdefaultlocale()[1]))
|
||||||
or (opts.usetitle and u'%(stitle)s-%(id)s.%(ext)s')
|
or (opts.usetitle and u'%(stitle)s-%(id)s.%(ext)s')
|
||||||
or (opts.useliteral and u'%(title)s-%(id)s.%(ext)s')
|
or (opts.useliteral and u'%(title)s-%(id)s.%(ext)s')
|
||||||
or u'%(id)s.%(ext)s'),
|
or u'%(id)s.%(ext)s'),
|
||||||
|
Loading…
Reference in New Issue
Block a user