diff options
author | Saimadhav Heblikar <sahutd@users.noreply.github.com> | 2014-01-15 11:49:50 +0530 |
---|---|---|
committer | Saimadhav Heblikar <sahutd@users.noreply.github.com> | 2014-01-15 11:49:50 +0530 |
commit | bf6705f5840418999582c6cf5cc0e2e47901cf4f (patch) | |
tree | c49e4e766f57c67e77a86390775bf9006a65bac5 /youtube_dl/extractor/franceinter.py | |
parent | a9f53ce7ea10d0f69e09bd38d4ab60d079229d93 (diff) |
Added franceinter [Issue #2105]
Diffstat (limited to 'youtube_dl/extractor/franceinter.py')
-rw-r--r-- | youtube_dl/extractor/franceinter.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/youtube_dl/extractor/franceinter.py b/youtube_dl/extractor/franceinter.py new file mode 100644 index 000000000..47e06f5a1 --- /dev/null +++ b/youtube_dl/extractor/franceinter.py @@ -0,0 +1,40 @@ +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' + _TEST={ + u'url':u'http://www.franceinter.fr/player/reecouter?play=793962', + u'file':u'793962.mp3' + + + } + + #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} + + |