aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/drtuber.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-08-11 23:47:27 +0700
committerSergey M․ <dstftw@gmail.com>2016-08-11 23:47:27 +0700
commit0aef0771f8cf18d97ce1b6b9123ce76bae45f3ef (patch)
tree58f15ce3f41dbdbbd7298c169182d8aa02042b7e /youtube_dl/extractor/drtuber.py
parent0c070681c56589d44f81df8ed2165bca4333cef5 (diff)
[drtuber] Make dislike count optional (Closes #10297)
Diffstat (limited to 'youtube_dl/extractor/drtuber.py')
-rw-r--r--youtube_dl/extractor/drtuber.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/youtube_dl/extractor/drtuber.py b/youtube_dl/extractor/drtuber.py
index 639f9182c..4e5557703 100644
--- a/youtube_dl/extractor/drtuber.py
+++ b/youtube_dl/extractor/drtuber.py
@@ -3,7 +3,10 @@ from __future__ import unicode_literals
import re
from .common import InfoExtractor
-from ..utils import str_to_int
+from ..utils import (
+ NO_DEFAULT,
+ str_to_int,
+)
class DrTuberIE(InfoExtractor):
@@ -17,7 +20,6 @@ class DrTuberIE(InfoExtractor):
'ext': 'mp4',
'title': 'hot perky blonde naked golf',
'like_count': int,
- 'dislike_count': int,
'comment_count': int,
'categories': ['Babe', 'Blonde', 'Erotic', 'Outdoor', 'Softcore', 'Solo'],
'thumbnail': 're:https?://.*\.jpg$',
@@ -43,18 +45,20 @@ class DrTuberIE(InfoExtractor):
r'poster="([^"]+)"',
webpage, 'thumbnail', fatal=False)
- def extract_count(id_, name):
+ def extract_count(id_, name, default=NO_DEFAULT):
return str_to_int(self._html_search_regex(
r'<span[^>]+(?:class|id)="%s"[^>]*>([\d,\.]+)</span>' % id_,
- webpage, '%s count' % name, fatal=False))
+ webpage, '%s count' % name, default=default, fatal=False))
like_count = extract_count('rate_likes', 'like')
- dislike_count = extract_count('rate_dislikes', 'dislike')
+ dislike_count = extract_count('rate_dislikes', 'dislike', default=None)
comment_count = extract_count('comments_count', 'comment')
cats_str = self._search_regex(
- r'<div[^>]+class="categories_list">(.+?)</div>', webpage, 'categories', fatal=False)
- categories = [] if not cats_str else re.findall(r'<a title="([^"]+)"', cats_str)
+ r'<div[^>]+class="categories_list">(.+?)</div>',
+ webpage, 'categories', fatal=False)
+ categories = [] if not cats_str else re.findall(
+ r'<a title="([^"]+)"', cats_str)
return {
'id': video_id,