mirror of https://github.com/yt-dlp/yt-dlp.git
add support for view count
This commit is contained in:
parent
676e3ecf24
commit
12c82cf9cb
|
@ -4,6 +4,7 @@ from __future__ import unicode_literals
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..utils import int_or_none
|
||||||
|
|
||||||
class VpornIE(InfoExtractor):
|
class VpornIE(InfoExtractor):
|
||||||
_VALID_URL = r'http?://(?:www\.)?vporn\.com/[a-z]+/(?P<title_dash>[a-z-]+)/(?P<id>\d+)/?'
|
_VALID_URL = r'http?://(?:www\.)?vporn\.com/[a-z]+/(?P<title_dash>[a-z-]+)/(?P<id>\d+)/?'
|
||||||
|
@ -30,15 +31,18 @@ class VpornIE(InfoExtractor):
|
||||||
description = self._html_search_regex(r'<div class="description_txt">(.*?)</div>', webpage, 'description')
|
description = self._html_search_regex(r'<div class="description_txt">(.*?)</div>', webpage, 'description')
|
||||||
thumbnail = 'http://www.vporn.com' + self._html_search_regex(r'flashvars.imageUrl = "(.*?)"', webpage, 'description')
|
thumbnail = 'http://www.vporn.com' + self._html_search_regex(r'flashvars.imageUrl = "(.*?)"', webpage, 'description')
|
||||||
|
|
||||||
mobj = re.search(
|
mobj = re.search(r'<span class="f_right">duration (?P<minutes>\d+) min (?P<seconds>\d+) sec </span>', webpage)
|
||||||
r'<span class="f_right">duration (?P<minutes>\d+) min (?P<seconds>\d+) sec </span>', webpage)
|
|
||||||
duration = int(mobj.group('minutes')) * 60 + int(mobj.group('seconds')) if mobj else None
|
duration = int(mobj.group('minutes')) * 60 + int(mobj.group('seconds')) if mobj else None
|
||||||
|
|
||||||
|
mobj = re.search(r'<span>((?P<thousands>\d+),)?(?P<units>\d+) VIEWS</span>', webpage)
|
||||||
|
view_count = int(mobj.group('thousands')) * 1000 + int(mobj.group('units')) if mobj else None
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
'title': title,
|
'title': title,
|
||||||
'description': description,
|
'description': description,
|
||||||
'duration': duration,
|
'duration': int_or_none(duration),
|
||||||
|
'view_count': int_or_none(view_count),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue