@ -0,0 +1,39 @@ | |||
#!/usr/bin/env python | |||
""" | |||
This script employs a VERY basic heuristic ('porn' in webpage.lower()) to check | |||
if we are not 'age_limit' tagging some porn site | |||
""" | |||
# Allow direct execution | |||
import os | |||
import sys | |||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | |||
from test.helper import get_testcases | |||
from youtube_dl.utils import compat_urllib_request | |||
for test in get_testcases(): | |||
try: | |||
webpage = compat_urllib_request.urlopen(test['url'], timeout=10).read() | |||
except: | |||
print('\nFail: {0}'.format(test['name'])) | |||
continue | |||
webpage = webpage.decode('utf8', 'replace') | |||
if 'porn' in webpage.lower() and ('info_dict' not in test | |||
or 'age_limit' not in test['info_dict'] | |||
or test['info_dict']['age_limit'] != 18): | |||
print('\nPotential missing age_limit check: {0}'.format(test['name'])) | |||
elif 'porn' not in webpage.lower() and ('info_dict' in test and | |||
'age_limit' in test['info_dict'] and | |||
test['info_dict']['age_limit'] == 18): | |||
print('\nPotential false negative: {0}'.format(test['name'])) | |||
else: | |||
sys.stdout.write('.') | |||
sys.stdout.flush() | |||
print() |
@ -0,0 +1,61 @@ | |||
import os | |||
import re | |||
from .common import InfoExtractor | |||
from ..utils import ( | |||
compat_urllib_parse_urlparse, | |||
compat_urllib_request, | |||
compat_urllib_parse, | |||
) | |||
from ..aes import ( | |||
aes_decrypt_text | |||
) | |||
class KeezMoviesIE(InfoExtractor): | |||
_VALID_URL = r'^(?:https?://)?(?:www\.)?(?P<url>keezmovies\.com/video/.+?(?P<videoid>[0-9]+))' | |||
_TEST = { | |||
u'url': u'http://www.keezmovies.com/video/petite-asian-lady-mai-playing-in-bathtub-1214711', | |||
u'file': u'1214711.mp4', | |||
u'md5': u'6e297b7e789329923fcf83abb67c9289', | |||
u'info_dict': { | |||
u"title": u"Petite Asian Lady Mai Playing In Bathtub", | |||
u"age_limit": 18, | |||
} | |||
} | |||
def _real_extract(self, url): | |||
mobj = re.match(self._VALID_URL, url) | |||
video_id = mobj.group('videoid') | |||
url = 'http://www.' + mobj.group('url') | |||
req = compat_urllib_request.Request(url) | |||
req.add_header('Cookie', 'age_verified=1') | |||
webpage = self._download_webpage(req, video_id) | |||
# embedded video | |||
mobj = re.search(r'href="([^"]+)"></iframe>', webpage) | |||
if mobj: | |||
embedded_url = mobj.group(1) | |||
return self.url_result(embedded_url) | |||
video_title = self._html_search_regex(r'<h1 [^>]*>([^<]+)', webpage, u'title') | |||
video_url = compat_urllib_parse.unquote(self._html_search_regex(r'video_url=(.+?)&', webpage, u'video_url')) | |||
if webpage.find('encrypted=true')!=-1: | |||
password = self._html_search_regex(r'video_title=(.+?)&', webpage, u'password') | |||
video_url = aes_decrypt_text(video_url, password, 32).decode('utf-8') | |||
path = compat_urllib_parse_urlparse( video_url ).path | |||
extension = os.path.splitext( path )[1][1:] | |||
format = path.split('/')[4].split('_')[:2] | |||
format = "-".join( format ) | |||
age_limit = self._rta_search(webpage) | |||
return { | |||
'id': video_id, | |||
'title': video_title, | |||
'url': video_url, | |||
'ext': extension, | |||
'format': format, | |||
'format_id': format, | |||
'age_limit': age_limit, | |||
} |
@ -0,0 +1,69 @@ | |||
import os | |||
import re | |||
from .common import InfoExtractor | |||
from ..utils import ( | |||
compat_urllib_parse_urlparse, | |||
compat_urllib_request, | |||
compat_urllib_parse, | |||
unescapeHTML, | |||
) | |||
from ..aes import ( | |||
aes_decrypt_text | |||
) | |||
class PornHubIE(InfoExtractor): | |||
_VALID_URL = r'^(?:https?://)?(?:www\.)?(?P<url>pornhub\.com/view_video\.php\?viewkey=(?P<videoid>[0-9]+))' | |||
_TEST = { | |||
u'url': u'http://www.pornhub.com/view_video.php?viewkey=648719015', | |||
u'file': u'648719015.mp4', | |||
u'md5': u'882f488fa1f0026f023f33576004a2ed', | |||
u'info_dict': { | |||
u"uploader": u"BABES-COM", | |||
u"title": u"Seductive Indian beauty strips down and fingers her pink pussy", | |||
u"age_limit": 18 | |||
} | |||
} | |||
def _real_extract(self, url): | |||
mobj = re.match(self._VALID_URL, url) | |||
video_id = mobj.group('videoid') | |||
url = 'http://www.' + mobj.group('url') | |||
req = compat_urllib_request.Request(url) | |||
req.add_header('Cookie', 'age_verified=1') | |||
webpage = self._download_webpage(req, video_id) | |||
video_title = self._html_search_regex(r'<h1 [^>]+>([^<]+)', webpage, u'title') | |||
video_uploader = self._html_search_regex(r'<b>From: </b>(?:\s|<[^>]*>)*(.+?)<', webpage, u'uploader', fatal=False) | |||
thumbnail = self._html_search_regex(r'"image_url":"([^"]+)', webpage, u'thumbnail', fatal=False) | |||
if thumbnail: | |||
thumbnail = compat_urllib_parse.unquote(thumbnail) | |||
video_urls = list(map(compat_urllib_parse.unquote , re.findall(r'"quality_[0-9]{3}p":"([^"]+)', webpage))) | |||
if webpage.find('"encrypted":true') != -1: | |||
password = self._html_search_regex(r'"video_title":"([^"]+)', webpage, u'password').replace('+', ' ') | |||
video_urls = list(map(lambda s: aes_decrypt_text(s, password, 32).decode('utf-8'), video_urls)) | |||
formats = [] | |||
for video_url in video_urls: | |||
path = compat_urllib_parse_urlparse( video_url ).path | |||
extension = os.path.splitext( path )[1][1:] | |||
format = path.split('/')[5].split('_')[:2] | |||
format = "-".join( format ) | |||
formats.append({ | |||
'url': video_url, | |||
'ext': extension, | |||
'format': format, | |||
'format_id': format, | |||
}) | |||
formats.sort(key=lambda format: list(map(lambda s: s.zfill(6), format['format'].split('-')))) | |||
return { | |||
'id': video_id, | |||
'uploader': video_uploader, | |||
'title': video_title, | |||
'thumbnail': thumbnail, | |||
'formats': formats, | |||
'age_limit': 18, | |||
} |
@ -0,0 +1,74 @@ | |||
import os | |||
import re | |||
from .common import InfoExtractor | |||
from ..utils import ( | |||
compat_urllib_parse_urlparse, | |||
compat_urllib_request, | |||
compat_urllib_parse, | |||
unescapeHTML, | |||
) | |||
from ..aes import ( | |||
aes_decrypt_text | |||
) | |||
class SpankwireIE(InfoExtractor): | |||
_VALID_URL = r'^(?:https?://)?(?:www\.)?(?P<url>spankwire\.com/[^/]*/video(?P<videoid>[0-9]+)/?)' | |||
_TEST = { | |||
u'url': u'http://www.spankwire.com/Buckcherry-s-X-Rated-Music-Video-Crazy-Bitch/video103545/', | |||
u'file': u'103545.mp4', | |||
u'md5': u'1b3f55e345500552dbc252a3e9c1af43', | |||
u'info_dict': { | |||
u"uploader": u"oreusz", | |||
u"title": u"Buckcherry`s X Rated Music Video Crazy Bitch", | |||
u"description": u"Crazy Bitch X rated music video.", | |||
u"age_limit": 18, | |||
} | |||
} | |||
def _real_extract(self, url): | |||
mobj = re.match(self._VALID_URL, url) | |||
video_id = mobj.group('videoid') | |||
url = 'http://www.' + mobj.group('url') | |||
req = compat_urllib_request.Request(url) | |||
req.add_header('Cookie', 'age_verified=1') | |||
webpage = self._download_webpage(req, video_id) | |||
video_title = self._html_search_regex(r'<h1>([^<]+)', webpage, u'title') | |||
video_uploader = self._html_search_regex(r'by:\s*<a [^>]*>(.+?)</a>', webpage, u'uploader', fatal=False) | |||
thumbnail = self._html_search_regex(r'flashvars\.image_url = "([^"]+)', webpage, u'thumbnail', fatal=False) | |||
description = self._html_search_regex(r'>\s*Description:</div>\s*<[^>]*>([^<]+)', webpage, u'description', fatal=False) | |||
if len(description) == 0: | |||
description = None | |||
video_urls = list(map(compat_urllib_parse.unquote , re.findall(r'flashvars\.quality_[0-9]{3}p = "([^"]+)', webpage))) | |||
if webpage.find('flashvars\.encrypted = "true"') != -1: | |||
password = self._html_search_regex(r'flashvars\.video_title = "([^"]+)', webpage, u'password').replace('+', ' ') | |||
video_urls = list(map(lambda s: aes_decrypt_text(s, password, 32).decode('utf-8'), video_urls)) | |||
formats = [] | |||
for video_url in video_urls: | |||
path = compat_urllib_parse_urlparse( video_url ).path | |||
extension = os.path.splitext( path )[1][1:] | |||
format = path.split('/')[4].split('_')[:2] | |||
format = "-".join( format ) | |||
formats.append({ | |||
'url': video_url, | |||
'ext': extension, | |||
'format': format, | |||
'format_id': format, | |||
}) | |||
formats.sort(key=lambda format: list(map(lambda s: s.zfill(6), format['format'].split('-')))) | |||
age_limit = self._rta_search(webpage) | |||
return { | |||
'id': video_id, | |||
'uploader': video_uploader, | |||
'title': video_title, | |||
'thumbnail': thumbnail, | |||
'description': description, | |||
'formats': formats, | |||
'age_limit': age_limit, | |||
} |
@ -0,0 +1,65 @@ | |||
import os | |||
import re | |||
from .common import InfoExtractor | |||
from ..utils import ( | |||
compat_urllib_parse_urlparse, | |||
compat_urllib_request, | |||
compat_urllib_parse, | |||
unescapeHTML, | |||
) | |||
from ..aes import ( | |||
aes_decrypt_text | |||
) | |||
class Tube8IE(InfoExtractor): | |||
_VALID_URL = r'^(?:https?://)?(?:www\.)?(?P<url>tube8\.com/[^/]+/[^/]+/(?P<videoid>[0-9]+)/?)' | |||
_TEST = { | |||
u'url': u'http://www.tube8.com/teen/kasia-music-video/229795/', | |||
u'file': u'229795.mp4', | |||
u'md5': u'e9e0b0c86734e5e3766e653509475db0', | |||
u'info_dict': { | |||
u"description": u"hot teen Kasia grinding", | |||
u"uploader": u"unknown", | |||
u"title": u"Kasia music video", | |||
u"age_limit": 18, | |||
} | |||
} | |||
def _real_extract(self, url): | |||
mobj = re.match(self._VALID_URL, url) | |||
video_id = mobj.group('videoid') | |||
url = 'http://www.' + mobj.group('url') | |||
req = compat_urllib_request.Request(url) | |||
req.add_header('Cookie', 'age_verified=1') | |||
webpage = self._download_webpage(req, video_id) | |||
video_title = self._html_search_regex(r'videotitle ="([^"]+)', webpage, u'title') | |||
video_description = self._html_search_regex(r'>Description:</strong>(.+?)<', webpage, u'description', fatal=False) | |||
video_uploader = self._html_search_regex(r'>Submitted by:</strong>(?:\s|<[^>]*>)*(.+?)<', webpage, u'uploader', fatal=False) | |||
thumbnail = self._html_search_regex(r'"image_url":"([^"]+)', webpage, u'thumbnail', fatal=False) | |||
if thumbnail: | |||
thumbnail = thumbnail.replace('\\/', '/') | |||
video_url = self._html_search_regex(r'"video_url":"([^"]+)', webpage, u'video_url') | |||
if webpage.find('"encrypted":true')!=-1: | |||
password = self._html_search_regex(r'"video_title":"([^"]+)', webpage, u'password') | |||
video_url = aes_decrypt_text(video_url, password, 32).decode('utf-8') | |||
path = compat_urllib_parse_urlparse( video_url ).path | |||
extension = os.path.splitext( path )[1][1:] | |||
format = path.split('/')[4].split('_')[:2] | |||
format = "-".join( format ) | |||
return { | |||
'id': video_id, | |||
'uploader': video_uploader, | |||
'title': video_title, | |||
'thumbnail': thumbnail, | |||
'description': video_description, | |||
'url': video_url, | |||
'ext': extension, | |||
'format': format, | |||
'format_id': format, | |||
'age_limit': 18, | |||
} |