[veoh] Allow to download videos with age protection (fixes #2455)
This commit is contained in:
parent
b1c6c32f78
commit
2bfe4ead4b
|
@ -4,6 +4,7 @@ import re
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..utils import compat_urllib_request
|
||||||
|
|
||||||
|
|
||||||
class VeohIE(InfoExtractor):
|
class VeohIE(InfoExtractor):
|
||||||
|
@ -24,6 +25,13 @@ class VeohIE(InfoExtractor):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
age_limit = 0
|
||||||
|
if 'class="adultwarning-container"' in webpage:
|
||||||
|
self.report_age_confirmation()
|
||||||
|
age_limit = 18
|
||||||
|
request = compat_urllib_request.Request(url)
|
||||||
|
request.add_header('Cookie', 'confirmedAdult=true')
|
||||||
|
webpage = self._download_webpage(request, video_id)
|
||||||
|
|
||||||
m_youtube = re.search(r'http://www\.youtube\.com/v/(.*?)(\&|")', webpage)
|
m_youtube = re.search(r'http://www\.youtube\.com/v/(.*?)(\&|")', webpage)
|
||||||
if m_youtube is not None:
|
if m_youtube is not None:
|
||||||
|
@ -44,4 +52,5 @@ class VeohIE(InfoExtractor):
|
||||||
'thumbnail': info.get('highResImage') or info.get('medResImage'),
|
'thumbnail': info.get('highResImage') or info.get('medResImage'),
|
||||||
'description': info['description'],
|
'description': info['description'],
|
||||||
'view_count': info['views'],
|
'view_count': info['views'],
|
||||||
|
'age_limit': age_limit,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue