mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-16 16:22:33 +00:00
[franceinter] Improve extraction (Closes #10538)
This commit is contained in:
parent
3e4185c396
commit
0002962f3f
1 changed files with 16 additions and 13 deletions
|
@ -2,10 +2,8 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..compat import compat_str
|
||||||
unified_timestamp,
|
from ..utils import month_by_name
|
||||||
month_by_name,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class FranceInterIE(InfoExtractor):
|
class FranceInterIE(InfoExtractor):
|
||||||
|
@ -18,8 +16,7 @@ class FranceInterIE(InfoExtractor):
|
||||||
'id': 'la-marche-de-l-histoire/la-marche-de-l-histoire-18-decembre-2013',
|
'id': 'la-marche-de-l-histoire/la-marche-de-l-histoire-18-decembre-2013',
|
||||||
'ext': 'mp3',
|
'ext': 'mp3',
|
||||||
'title': 'L’Histoire dans les jeux vidéo du 18 décembre 2013 - France Inter',
|
'title': 'L’Histoire dans les jeux vidéo du 18 décembre 2013 - France Inter',
|
||||||
'description': 'L’Histoire dans les jeux vidéo du 18 décembre 2013 par Jean Lebrun en replay sur France Inter. Retrouvez l\'émission en réécoute gratuite et abonnez-vous au podcast !',
|
'description': 'md5:7f2ce449894d1e585932273080fb410d',
|
||||||
'timestamp': 1387324800,
|
|
||||||
'upload_date': '20131218',
|
'upload_date': '20131218',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -30,22 +27,28 @@ class FranceInterIE(InfoExtractor):
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
video_url = self._search_regex(
|
video_url = self._search_regex(
|
||||||
r'<button class="replay-button playable" data-is-aod="1" data-url="([^"]+)"', webpage, 'video url')
|
r'(?s)<div[^>]+class=["\']page-diffusion["\'][^>]*>.*?<button[^>]+data-url=(["\'])(?P<url>(?:(?!\1).)+)\1',
|
||||||
|
webpage, 'video url', group='url')
|
||||||
|
|
||||||
title = self._og_search_title(webpage)
|
title = self._og_search_title(webpage)
|
||||||
description = self._og_search_description(webpage)
|
description = self._og_search_description(webpage)
|
||||||
|
|
||||||
extractdate = self._search_regex('(\d{2}-([a-zA-Z\s]+)-\d{4}$)', url, 'extractdate', fatal=False)
|
upload_date_str = self._search_regex(
|
||||||
extractdate = extractdate.split('-')
|
r'class=["\']cover-emission-period["\'][^>]*>[^<]+\s+(\d{1,2}\s+[^\s]+\s+\d{4})<',
|
||||||
extractdate = extractdate[2] + "," + str(month_by_name(extractdate[1], 'fr')) + "," + extractdate[0]
|
webpage, 'upload date', fatal=False)
|
||||||
|
if upload_date_str:
|
||||||
timestamp = unified_timestamp(extractdate)
|
upload_date_list = upload_date_str.split()
|
||||||
|
upload_date_list.reverse()
|
||||||
|
upload_date_list[1] = compat_str(month_by_name(upload_date_list[1], lang='fr'))
|
||||||
|
upload_date = ''.join(upload_date_list)
|
||||||
|
else:
|
||||||
|
upload_date = None
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
'description': description,
|
'description': description,
|
||||||
'timestamp': timestamp,
|
'upload_date': upload_date,
|
||||||
'formats': [{
|
'formats': [{
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'vcodec': 'none',
|
'vcodec': 'none',
|
||||||
|
|
Loading…
Reference in a new issue