]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/watchindianporn.py
Completely change project name to yt-dlp (#85)
[yt-dlp.git] / yt_dlp / extractor / watchindianporn.py
CommitLineData
1910077e
YCH
1# coding: utf-8
2from __future__ import unicode_literals
3
4import re
5
6from .common import InfoExtractor
048b5580 7from ..utils import parse_duration
1910077e
YCH
8
9
14638e29
YCH
10class WatchIndianPornIE(InfoExtractor):
11 IE_DESC = 'Watch Indian Porn'
12 _VALID_URL = r'https?://(?:www\.)?watchindianporn\.net/(?:[^/]+/)*video/(?P<display_id>[^/]+)-(?P<id>[a-zA-Z0-9]+)\.html'
13 _TEST = {
14 'url': 'http://www.watchindianporn.net/video/hot-milf-from-kerala-shows-off-her-gorgeous-large-breasts-on-camera-RZa2avywNPa.html',
15 'md5': '249589a164dde236ec65832bfce17440',
1910077e 16 'info_dict': {
14638e29
YCH
17 'id': 'RZa2avywNPa',
18 'display_id': 'hot-milf-from-kerala-shows-off-her-gorgeous-large-breasts-on-camera',
1910077e 19 'ext': 'mp4',
14638e29 20 'title': 'Hot milf from kerala shows off her gorgeous large breasts on camera',
ec85ded8 21 'thumbnail': r're:^https?://.*\.jpg$',
14638e29 22 'duration': 226,
1910077e 23 'view_count': int,
1910077e
YCH
24 'categories': list,
25 'age_limit': 18,
26 }
14638e29 27 }
1910077e
YCH
28
29 def _real_extract(self, url):
30 mobj = re.match(self._VALID_URL, url)
31 video_id = mobj.group('id')
32 display_id = mobj.group('display_id')
33
34 webpage = self._download_webpage(url, display_id)
35
048b5580 36 info_dict = self._parse_html5_media_entries(url, webpage, video_id)[0]
1910077e 37
048b5580
GF
38 title = self._html_search_regex((
39 r'<title>(.+?)\s*-\s*Indian\s+Porn</title>',
40 r'<h4>(.+?)</h4>'
41 ), webpage, 'title')
1910077e
YCH
42
43 duration = parse_duration(self._search_regex(
048b5580 44 r'Time:\s*<strong>\s*(.+?)\s*</strong>',
1910077e
YCH
45 webpage, 'duration', fatal=False))
46
048b5580
GF
47 view_count = int(self._search_regex(
48 r'(?s)Time:\s*<strong>.*?</strong>.*?<strong>\s*(\d+)\s*</strong>',
1910077e 49 webpage, 'view count', fatal=False))
1910077e
YCH
50
51 categories = re.findall(
048b5580 52 r'<a[^>]+class=[\'"]categories[\'"][^>]*>\s*([^<]+)\s*</a>',
1910077e
YCH
53 webpage)
54
048b5580 55 info_dict.update({
1910077e
YCH
56 'id': video_id,
57 'display_id': display_id,
14638e29
YCH
58 'http_headers': {
59 'Referer': url,
60 },
1910077e 61 'title': title,
1910077e
YCH
62 'duration': duration,
63 'view_count': view_count,
1910077e
YCH
64 'categories': categories,
65 'age_limit': 18,
048b5580
GF
66 })
67
68 return info_dict