1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-05 18:04:31 +01:00
youtube-dl/youtube_dl/extractor/sexykarma.py

121 lines
4.3 KiB
Python
Raw Normal View History

2014-10-15 18:24:32 +02:00
# coding: utf-8
from __future__ import unicode_literals
2014-10-15 20:17:07 +02:00
import re
2014-10-18 19:48:05 +02:00
from .common import InfoExtractor
from ..utils import (
unified_strdate,
parse_duration,
int_or_none,
)
2014-10-15 18:24:32 +02:00
class SexyKarmaIE(InfoExtractor):
IE_DESC = 'Sexy Karma and Watch Indian Porn'
_VALID_URL = r'https?://(?:www\.)?(?:sexykarma\.com|watchindianporn\.net)/(?:[^/]+/)*video/(?P<display_id>[^/]+)-(?P<id>[a-zA-Z0-9]+)\.html'
2014-10-15 18:24:32 +02:00
_TESTS = [{
'url': 'http://www.sexykarma.com/gonewild/video/taking-a-quick-pee-yHI70cOyIHt.html',
'md5': 'b9798e7d1ef1765116a8f516c8091dbd',
'info_dict': {
2014-10-15 20:17:07 +02:00
'id': 'yHI70cOyIHt',
2014-10-18 19:48:05 +02:00
'display_id': 'taking-a-quick-pee',
2014-10-15 18:24:32 +02:00
'ext': 'mp4',
'title': 'Taking a quick pee.',
2014-10-15 20:17:07 +02:00
'thumbnail': 're:^https?://.*\.jpg$',
2014-10-18 19:48:05 +02:00
'uploader': 'wildginger7',
2015-01-07 11:47:03 +01:00
'upload_date': '20141008',
'duration': 22,
2014-10-18 19:48:05 +02:00
'view_count': int,
'comment_count': int,
'categories': list,
2014-10-15 18:24:32 +02:00
}
}, {
'url': 'http://www.sexykarma.com/gonewild/video/pot-pixie-tribute-8Id6EZPbuHf.html',
'md5': 'dd216c68d29b49b12842b9babe762a5d',
'info_dict': {
2014-10-15 20:17:07 +02:00
'id': '8Id6EZPbuHf',
2014-10-18 19:48:05 +02:00
'display_id': 'pot-pixie-tribute',
2014-10-15 18:24:32 +02:00
'ext': 'mp4',
'title': 'pot_pixie tribute',
2014-10-15 20:17:07 +02:00
'thumbnail': 're:^https?://.*\.jpg$',
2014-10-18 19:48:05 +02:00
'uploader': 'banffite',
2014-10-15 20:17:07 +02:00
'upload_date': '20141013',
2014-10-18 19:48:05 +02:00
'duration': 16,
'view_count': int,
'comment_count': int,
'categories': list,
2015-01-07 11:47:03 +01:00
'age_limit': 18,
2014-10-15 18:24:32 +02:00
}
}, {
'url': 'http://www.watchindianporn.net/video/desi-dancer-namrata-stripping-completely-nude-and-dancing-on-a-hot-number-dW2mtctxJfs.html',
'md5': '9afb80675550406ed9a63ac2819ef69d',
'info_dict': {
'id': 'dW2mtctxJfs',
'display_id': 'desi-dancer-namrata-stripping-completely-nude-and-dancing-on-a-hot-number',
'ext': 'mp4',
'title': 'Desi dancer namrata stripping completely nude and dancing on a hot number',
'thumbnail': 're:^https?://.*\.jpg$',
'uploader': 'Don',
'upload_date': '20140213',
'duration': 83,
'view_count': int,
'comment_count': int,
'categories': list,
2015-01-07 11:47:03 +01:00
'age_limit': 18,
}
2014-10-15 18:24:32 +02:00
}]
def _real_extract(self, url):
2014-10-18 19:48:05 +02:00
mobj = re.match(self._VALID_URL, url)
video_id = mobj.group('id')
display_id = mobj.group('display_id')
webpage = self._download_webpage(url, display_id)
video_url = self._html_search_regex(
r"url: escape\('([^']+)'\)", webpage, 'url')
2014-10-18 19:48:05 +02:00
title = self._html_search_regex(
r'<h2 class="he2"><span>(.*?)</span>',
webpage, 'title')
thumbnail = self._html_search_regex(
r'<span id="container"><img\s+src="([^"]+)"',
webpage, 'thumbnail', fatal=False)
2014-10-15 18:24:32 +02:00
2014-10-18 19:48:05 +02:00
uploader = self._html_search_regex(
r'class="aupa">\s*(.*?)</a>',
webpage, 'uploader')
upload_date = unified_strdate(self._html_search_regex(
r'Added: <strong>(.+?)</strong>', webpage, 'upload date', fatal=False))
2014-10-15 20:17:07 +02:00
2014-10-18 19:48:05 +02:00
duration = parse_duration(self._search_regex(
r'<td>Time:\s*</td>\s*<td align="right"><span>\s*(.+?)\s*</span>',
webpage, 'duration', fatal=False))
2014-10-15 20:17:07 +02:00
2014-10-18 19:48:05 +02:00
view_count = int_or_none(self._search_regex(
r'<td>Views:\s*</td>\s*<td align="right"><span>\s*(\d+)\s*</span>',
webpage, 'view count', fatal=False))
comment_count = int_or_none(self._search_regex(
r'<td>Comments:\s*</td>\s*<td align="right"><span>\s*(\d+)\s*</span>',
webpage, 'comment count', fatal=False))
2014-10-15 18:24:32 +02:00
categories = re.findall(
r'<a href="[^"]+/search/video/desi"><span>([^<]+)</span></a>',
webpage)
2014-10-15 22:34:35 +02:00
2014-10-15 18:24:32 +02:00
return {
'id': video_id,
2014-10-18 19:48:05 +02:00
'display_id': display_id,
'url': video_url,
2014-10-15 18:24:32 +02:00
'title': title,
2014-10-15 20:17:07 +02:00
'thumbnail': thumbnail,
2014-10-18 19:48:05 +02:00
'uploader': uploader,
'upload_date': upload_date,
2014-10-15 20:17:07 +02:00
'duration': duration,
'view_count': view_count,
2014-10-18 19:48:05 +02:00
'comment_count': comment_count,
2014-10-15 22:34:35 +02:00
'categories': categories,
2015-01-07 11:47:03 +01:00
'age_limit': 18,
2014-10-15 18:24:32 +02:00
}