mirror of
https://github.com/l1ving/youtube-dl
synced 2025-03-14 07:37:25 +08:00
Create franceinter.py
This commit is contained in:
parent
4950f30890
commit
75df2f23cd
35
youtube_dl/extractor/franceinter.py
Normal file
35
youtube_dl/extractor/franceinter.py
Normal file
@ -0,0 +1,35 @@
|
||||
import re
|
||||
|
||||
from .common import InfoExtractor
|
||||
class FranceInterIE(InfoExtractor):
|
||||
|
||||
_VALID_URL=r'http://www.franceinter.fr/player/reecouter\?play=(?P<id>[0-9]{6})'
|
||||
IE_NAME='FranceInter'
|
||||
|
||||
|
||||
#Easier to use python string matching than regex for a simple match
|
||||
def get_download_url(self,webpage):
|
||||
|
||||
start=webpage.index('&urlAOD=')+8
|
||||
end=webpage.index('&startTime')
|
||||
return u'http://www.franceinter.fr/%s'%webpage[start:end]
|
||||
|
||||
def get_title(self,webpage):
|
||||
start=webpage.index('<span class="title diffusion">')+30
|
||||
end=webpage.index('</span> dans')
|
||||
|
||||
return webpage[start:end]
|
||||
def _real_extract(self,url):
|
||||
|
||||
mobj = re.match(self._VALID_URL, url)
|
||||
video_id = mobj.group('id')
|
||||
|
||||
webpage=self._download_webpage(url,video_id)
|
||||
|
||||
title=self.get_title(webpage)
|
||||
|
||||
video_url=self.get_download_url(webpage)
|
||||
|
||||
return{'id': video_id,u'url': video_url,u'title': title}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user