1
0
Fork 0
mirror of https://gitlab.com/dstftw/youtube-dl.git synced 2020-11-16 09:42:26 +00:00

[franceinter] Minor improvements (#2152)

This commit is contained in:
Philipp Hagemeister 2014-01-17 03:09:07 +01:00
parent fabfe17d5e
commit 677b3ce82f

View file

@ -1,31 +1,40 @@
# coding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals
import re import re
from .common import InfoExtractor from .common import InfoExtractor
class FranceInterIE(InfoExtractor): class FranceInterIE(InfoExtractor):
_VALID_URL = r'http://(?:www\.)?franceinter\.fr/player/reecouter\?play=(?P<id>[0-9]{6})'
_VALID_URL=r'http://(?:www\.)?franceinter\.fr/player/reecouter\?play=(?P<id>[0-9]{6})' _TEST = {
_TEST={ 'url': 'http://www.franceinter.fr/player/reecouter?play=793962',
u'url':u'http://www.franceinter.fr/player/reecouter?play=793962', 'file': '793962.mp3',
u'file':u'793962.mp3' 'md5': '4764932e466e6f6c79c317d2e74f6884',
"info_dict": {
"title": "LHistoire dans les jeux vidéo",
},
} }
def _real_extract(self, url):
def _real_extract(self,url):
mobj = re.match(self._VALID_URL, url) mobj = re.match(self._VALID_URL, url)
video_id = mobj.group('id') video_id = mobj.group('id')
webpage=self._download_webpage(url,video_id) webpage = self._download_webpage(url, video_id)
title = self._html_search_regex(
r'<span class="roll_overflow">(.*?)</span></h1>', webpage, 'title')
path = self._search_regex(
r'&urlAOD=(.*?)&startTime', webpage, 'video url')
video_url = 'http://www.franceinter.fr/' + path
title=self._search_regex(u'(?<=<span class="roll_overflow">)(.*)(?=</span></h1>)', webpage, u'title') return {
'id': video_id,
video_url='http://www.franceinter.fr/'+self._search_regex(u'(?<=&urlAOD=)(.*)(?=&startTime)', webpage, u'video url') 'formats': [{
'url': video_url,
return{'id': video_id,u'url': video_url,u'title': title} 'vcodec': 'none',
}],
'title': title,
}