From 4eed7f145ffb0c50fd969e9a1d1a839743e99c59 Mon Sep 17 00:00:00 2001 From: gfabiano Date: Mon, 19 Jun 2017 22:25:33 +0200 Subject: [PATCH 1/2] [watchindianporn] Fix parser --- youtube_dl/extractor/watchindianporn.py | 43 +++++++------------------ 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/youtube_dl/extractor/watchindianporn.py b/youtube_dl/extractor/watchindianporn.py index ed099beea..8064aec00 100644 --- a/youtube_dl/extractor/watchindianporn.py +++ b/youtube_dl/extractor/watchindianporn.py @@ -5,7 +5,6 @@ import re from .common import InfoExtractor from ..utils import ( - unified_strdate, parse_duration, int_or_none, ) @@ -23,11 +22,8 @@ class WatchIndianPornIE(InfoExtractor): 'ext': 'mp4', 'title': 'Hot milf from kerala shows off her gorgeous large breasts on camera', 'thumbnail': r're:^https?://.*\.jpg$', - 'uploader': 'LoveJay', - 'upload_date': '20160428', 'duration': 226, 'view_count': int, - 'comment_count': int, 'categories': list, 'age_limit': 18, } @@ -40,51 +36,36 @@ class WatchIndianPornIE(InfoExtractor): webpage = self._download_webpage(url, display_id) - video_url = self._html_search_regex( - r"url: escape\('([^']+)'\)", webpage, 'url') + info_dict = self._parse_html5_media_entries(url, webpage, video_id)[0] - title = self._html_search_regex( - r'

(.*?)', - webpage, 'title') - thumbnail = self._html_search_regex( - r'\s*(.*?)', - webpage, 'uploader') - upload_date = unified_strdate(self._html_search_regex( - r'Added: (.+?)', webpage, 'upload date', fatal=False)) + title = self._html_search_regex(( + r'(.+?)-\s+Indian\s+Porn', + r'

(.+?)

' + ), webpage, 'title') duration = parse_duration(self._search_regex( - r'Time:\s*\s*\s*(.+?)\s*', + r'Time:\s*\s*(.+?)\s*', webpage, 'duration', fatal=False)) view_count = int_or_none(self._search_regex( - r'Views:\s*\s*\s*(\d+)\s*', + r'(?s)Time:\s*\s*.+?\s*.*?\s*(\d+)\s*', webpage, 'view count', fatal=False)) - comment_count = int_or_none(self._search_regex( - r'Comments:\s*\s*\s*(\d+)\s*', - webpage, 'comment count', fatal=False)) categories = re.findall( - r'([^<]+)', + r']+?class=[\'"]categories[\'"]>\s*([^<]+)\s*', webpage) - return { + info_dict.update({ 'id': video_id, 'display_id': display_id, - 'url': video_url, 'http_headers': { 'Referer': url, }, 'title': title, - 'thumbnail': thumbnail, - 'uploader': uploader, - 'upload_date': upload_date, 'duration': duration, 'view_count': view_count, - 'comment_count': comment_count, 'categories': categories, 'age_limit': 18, - } + }) + + return info_dict From 31aedad5e7f9af24db0552b60fdd46e5dc23d7cf Mon Sep 17 00:00:00 2001 From: Sergey M Date: Tue, 20 Jun 2017 04:29:56 +0700 Subject: [PATCH 2/2] Update watchindianporn.py --- youtube_dl/extractor/watchindianporn.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/youtube_dl/extractor/watchindianporn.py b/youtube_dl/extractor/watchindianporn.py index 8064aec00..fadc539ee 100644 --- a/youtube_dl/extractor/watchindianporn.py +++ b/youtube_dl/extractor/watchindianporn.py @@ -4,10 +4,7 @@ from __future__ import unicode_literals import re from .common import InfoExtractor -from ..utils import ( - parse_duration, - int_or_none, -) +from ..utils import parse_duration class WatchIndianPornIE(InfoExtractor): @@ -39,7 +36,7 @@ class WatchIndianPornIE(InfoExtractor): info_dict = self._parse_html5_media_entries(url, webpage, video_id)[0] title = self._html_search_regex(( - r'(.+?)-\s+Indian\s+Porn', + r'(.+?)\s*-\s*Indian\s+Porn', r'

(.+?)

' ), webpage, 'title') @@ -47,12 +44,12 @@ class WatchIndianPornIE(InfoExtractor): r'Time:\s*\s*(.+?)\s*', webpage, 'duration', fatal=False)) - view_count = int_or_none(self._search_regex( - r'(?s)Time:\s*\s*.+?\s*.*?\s*(\d+)\s*', + view_count = int(self._search_regex( + r'(?s)Time:\s*.*?.*?\s*(\d+)\s*', webpage, 'view count', fatal=False)) categories = re.findall( - r']+?class=[\'"]categories[\'"]>\s*([^<]+)\s*', + r']+class=[\'"]categories[\'"][^>]*>\s*([^<]+)\s*', webpage) info_dict.update({