X-Git-Url: https://git.rapsys.eu/youtubedl/blobdiff_plain/a070911bf98c751e4425008f1335cc57c86d30fc..c64c42cb1f9487398f8b91a51266ff6e79115b90:/youtube_dl/extractor/fourtube.py?ds=sidebyside
diff --git a/youtube_dl/extractor/fourtube.py b/youtube_dl/extractor/fourtube.py
index b2284ab..9776c84 100644
--- a/youtube_dl/extractor/fourtube.py
+++ b/youtube_dl/extractor/fourtube.py
@@ -3,12 +3,10 @@ from __future__ import unicode_literals
import re
from .common import InfoExtractor
-from ..compat import (
- compat_urllib_request,
-)
from ..utils import (
parse_duration,
parse_iso8601,
+ sanitized_Request,
str_to_int,
)
@@ -32,6 +30,7 @@ class FourTubeIE(InfoExtractor):
'view_count': int,
'like_count': int,
'categories': list,
+ 'age_limit': 18,
}
}
@@ -44,14 +43,14 @@ class FourTubeIE(InfoExtractor):
'uploadDate', webpage))
thumbnail = self._html_search_meta('thumbnailUrl', webpage)
uploader_id = self._html_search_regex(
- r'',
- webpage, 'uploader id')
+ r'',
+ webpage, 'uploader id', fatal=False)
uploader = self._html_search_regex(
- r'',
- webpage, 'uploader')
+ r'',
+ webpage, 'uploader', fatal=False)
categories_html = self._search_regex(
- r'(?s)>\s*Categories / Tags\s*.*?',
+ r'(?s)>\s*Categories / Tags\s*.*?',
webpage, 'categories', fatal=False)
categories = None
if categories_html:
@@ -60,20 +59,31 @@ class FourTubeIE(InfoExtractor):
r'(?s)(.*?)', categories_html)]
view_count = str_to_int(self._search_regex(
- r'',
+ r']+itemprop="interactionCount"[^>]+content="UserPlays:([0-9,]+)">',
webpage, 'view count', fatal=False))
like_count = str_to_int(self._search_regex(
- r'',
+ r']+itemprop="interactionCount"[^>]+content="UserLikes:([0-9,]+)">',
webpage, 'like count', fatal=False))
duration = parse_duration(self._html_search_meta('duration', webpage))
- params_js = self._search_regex(
- r'\$\.ajax\(url,\ opts\);\s*\}\s*\}\)\(([0-9,\[\] ]+)\)',
- webpage, 'initialization parameters'
- )
- params = self._parse_json('[%s]' % params_js, video_id)
- media_id = params[0]
- sources = ['%s' % p for p in params[2]]
+ media_id = self._search_regex(
+ r'