Made modification as suggested on https://github.com/rg3/youtube-dl/pull/2151
authorsahutd <sahutd@gmail.com>
Wed, 15 Jan 2014 11:18:55 +0000 (16:48 +0530)
committersahutd <sahutd@gmail.com>
Wed, 15 Jan 2014 11:18:55 +0000 (16:48 +0530)
youtube_dl/extractor/franceinter.py

index 47e06f5a1ada8a976a7988b438e0fd06115cc799..932a1f161794a8b89487e2d7483f651c0c3b1551 100644 (file)
@@ -1,29 +1,20 @@
+from __future__ import unicode_literals
+
 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'
+    _VALID_URL=r'http://(?:www\.)?franceinter\.fr/player/reecouter\?play=(?P<id>[0-9]{6})'
     _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)
@@ -31,10 +22,10 @@ class FranceInterIE(InfoExtractor):
         
         webpage=self._download_webpage(url,video_id)
         
-        title=self.get_title(webpage)
+        title=self._search_regex(u'(?<=<span class="roll_overflow">)(.*)(?=</span></h1>)', webpage, u'title')
         
-        video_url=self.get_download_url(webpage)
+        video_url='http://www.franceinter.fr/'+self._search_regex(u'(?<=&urlAOD=)(.*)(?=&startTime)', webpage, u'video url')
         
         return{'id': video_id,u'url': video_url,u'title': title}
         
-        
+        
\ No newline at end of file