mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-23 02:25:11 +00:00
[ccc] Extract duration
This commit is contained in:
parent
8499d21158
commit
82597f0ec0
1 changed files with 6 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
int_or_none,
|
int_or_none,
|
||||||
|
parse_duration,
|
||||||
qualities,
|
qualities,
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
)
|
)
|
||||||
|
@ -25,6 +26,7 @@ class CCCIE(InfoExtractor):
|
||||||
'thumbnail': 're:^https?://.*\.jpg$',
|
'thumbnail': 're:^https?://.*\.jpg$',
|
||||||
'view_count': int,
|
'view_count': int,
|
||||||
'upload_date': '20131228',
|
'upload_date': '20131228',
|
||||||
|
'duration': 3660,
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://media.ccc.de/v/32c3-7368-shopshifting#download',
|
'url': 'https://media.ccc.de/v/32c3-7368-shopshifting#download',
|
||||||
|
@ -51,6 +53,9 @@ def _real_extract(self, url):
|
||||||
view_count = int_or_none(self._html_search_regex(
|
view_count = int_or_none(self._html_search_regex(
|
||||||
r"(?s)<span class='[^']*fa-eye'></span>(.*?)</li>",
|
r"(?s)<span class='[^']*fa-eye'></span>(.*?)</li>",
|
||||||
webpage, 'view count', fatal=False))
|
webpage, 'view count', fatal=False))
|
||||||
|
duration = parse_duration(self._html_search_regex(
|
||||||
|
r'(?s)<span[^>]+class=(["\']).*?fa-clock-o.*?\1[^>]*></span>(?P<duration>.+?)</li',
|
||||||
|
webpage, 'duration', fatal=False, group='duration'))
|
||||||
|
|
||||||
matches = re.finditer(r'''(?xs)
|
matches = re.finditer(r'''(?xs)
|
||||||
<(?:span|div)\s+class='label\s+filetype'>(?P<format>.*?)</(?:span|div)>\s*
|
<(?:span|div)\s+class='label\s+filetype'>(?P<format>.*?)</(?:span|div)>\s*
|
||||||
|
@ -98,5 +103,6 @@ def _real_extract(self, url):
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
'view_count': view_count,
|
'view_count': view_count,
|
||||||
'upload_date': upload_date,
|
'upload_date': upload_date,
|
||||||
|
'duration': duration,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue