0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-17 01:25:11 +00:00

[ndr] Fix title, description and duration extraction

This commit is contained in:
Sergey M․ 2014-05-17 18:11:40 +07:00
parent 1514f74967
commit c1ed1f7055

View file

@ -4,7 +4,10 @@
import re import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ExtractorError from ..utils import (
ExtractorError,
int_or_none,
)
class NDRIE(InfoExtractor): class NDRIE(InfoExtractor):
@ -45,13 +48,12 @@ def _real_extract(self, url):
page = self._download_webpage(url, video_id, 'Downloading page') page = self._download_webpage(url, video_id, 'Downloading page')
title = self._og_search_title(page) title = self._og_search_title(page).strip()
description = self._og_search_description(page) description = self._og_search_description(page)
if description:
description = description.strip()
mobj = re.search( duration = int_or_none(self._html_search_regex(r'duration: (\d+),\n', page, 'duration', fatal=False))
r'<div class="duration"><span class="min">(?P<minutes>\d+)</span>:<span class="sec">(?P<seconds>\d+)</span></div>',
page)
duration = int(mobj.group('minutes')) * 60 + int(mobj.group('seconds')) if mobj else None
formats = [] formats = []