]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/watchindianporn.py
Prepare new release.
[youtubedl] / youtube_dl / extractor / watchindianporn.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 import re
5
6 from .common import InfoExtractor
7 from ..utils import (
8 unified_strdate,
9 parse_duration,
10 int_or_none,
11 )
12
13
14 class WatchIndianPornIE(InfoExtractor):
15 IE_DESC = 'Watch Indian Porn'
16 _VALID_URL = r'https?://(?:www\.)?watchindianporn\.net/(?:[^/]+/)*video/(?P<display_id>[^/]+)-(?P<id>[a-zA-Z0-9]+)\.html'
17 _TEST = {
18 'url': 'http://www.watchindianporn.net/video/hot-milf-from-kerala-shows-off-her-gorgeous-large-breasts-on-camera-RZa2avywNPa.html',
19 'md5': '249589a164dde236ec65832bfce17440',
20 'info_dict': {
21 'id': 'RZa2avywNPa',
22 'display_id': 'hot-milf-from-kerala-shows-off-her-gorgeous-large-breasts-on-camera',
23 'ext': 'mp4',
24 'title': 'Hot milf from kerala shows off her gorgeous large breasts on camera',
25 'thumbnail': r're:^https?://.*\.jpg$',
26 'uploader': 'LoveJay',
27 'upload_date': '20160428',
28 'duration': 226,
29 'view_count': int,
30 'comment_count': int,
31 'categories': list,
32 'age_limit': 18,
33 }
34 }
35
36 def _real_extract(self, url):
37 mobj = re.match(self._VALID_URL, url)
38 video_id = mobj.group('id')
39 display_id = mobj.group('display_id')
40
41 webpage = self._download_webpage(url, display_id)
42
43 video_url = self._html_search_regex(
44 r"url: escape\('([^']+)'\)", webpage, 'url')
45
46 title = self._html_search_regex(
47 r'<h2 class="he2"><span>(.*?)</span>',
48 webpage, 'title')
49 thumbnail = self._html_search_regex(
50 r'<span id="container"><img\s+src="([^"]+)"',
51 webpage, 'thumbnail', fatal=False)
52
53 uploader = self._html_search_regex(
54 r'class="aupa">\s*(.*?)</a>',
55 webpage, 'uploader')
56 upload_date = unified_strdate(self._html_search_regex(
57 r'Added: <strong>(.+?)</strong>', webpage, 'upload date', fatal=False))
58
59 duration = parse_duration(self._search_regex(
60 r'<td>Time:\s*</td>\s*<td align="right"><span>\s*(.+?)\s*</span>',
61 webpage, 'duration', fatal=False))
62
63 view_count = int_or_none(self._search_regex(
64 r'<td>Views:\s*</td>\s*<td align="right"><span>\s*(\d+)\s*</span>',
65 webpage, 'view count', fatal=False))
66 comment_count = int_or_none(self._search_regex(
67 r'<td>Comments:\s*</td>\s*<td align="right"><span>\s*(\d+)\s*</span>',
68 webpage, 'comment count', fatal=False))
69
70 categories = re.findall(
71 r'<a href="[^"]+/search/video/desi"><span>([^<]+)</span></a>',
72 webpage)
73
74 return {
75 'id': video_id,
76 'display_id': display_id,
77 'url': video_url,
78 'http_headers': {
79 'Referer': url,
80 },
81 'title': title,
82 'thumbnail': thumbnail,
83 'uploader': uploader,
84 'upload_date': upload_date,
85 'duration': duration,
86 'view_count': view_count,
87 'comment_count': comment_count,
88 'categories': categories,
89 'age_limit': 18,
90 }