radiofrance: Support franceinfo archives
This commit is contained in:
parent
d60bdd0c25
commit
9d5f808de9
1 changed files with 17 additions and 6 deletions
|
|
@ -36,7 +36,7 @@ __all__ = ['RadioFranceBrowser', 'RadioFranceVideo']
|
||||||
|
|
||||||
|
|
||||||
class RadioFranceVideo(BaseVideo):
|
class RadioFranceVideo(BaseVideo):
|
||||||
RADIO_DOMAINS = ('franceinter', 'franceculture', 'fipradio', )
|
RADIO_DOMAINS = ('franceinter', 'franceculture', 'fipradio', 'franceinfo')
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
BaseVideo.__init__(self, *args, **kwargs)
|
BaseVideo.__init__(self, *args, **kwargs)
|
||||||
|
|
@ -65,6 +65,9 @@ class PlayerPage(BasePage):
|
||||||
class ReplayPage(BasePage):
|
class ReplayPage(BasePage):
|
||||||
URL = r'^http://www\.(?P<rdomain>%s)\.fr/(?:emission|diffusion)-.+$' \
|
URL = r'^http://www\.(?P<rdomain>%s)\.fr/(?:emission|diffusion)-.+$' \
|
||||||
% '|'.join(RadioFranceVideo.RADIO_DOMAINS)
|
% '|'.join(RadioFranceVideo.RADIO_DOMAINS)
|
||||||
|
# the url does not always end with id-yyy-mm-dd, sometimes no mm or dd
|
||||||
|
URL2 = r'^http://www\.(?P<rdomain>%s)\.fr/[a-z\-]+/[0-9a-z\-]+/[0-9a-z\-]+-[0-9\-]+' \
|
||||||
|
% 'franceinfo'
|
||||||
|
|
||||||
def get_id(self):
|
def get_id(self):
|
||||||
radio_domain = self.groups[0]
|
radio_domain = self.groups[0]
|
||||||
|
|
@ -82,6 +85,13 @@ class ReplayPage(BasePage):
|
||||||
if match:
|
if match:
|
||||||
player_id = match.groups()[0]
|
player_id = match.groups()[0]
|
||||||
return (radio_domain, player_id)
|
return (radio_domain, player_id)
|
||||||
|
# at least for franceinfo
|
||||||
|
for node in self.parser.select(self.document.getroot(), '#article .emission-player a.play'):
|
||||||
|
match = re.match(r'^song-(\d+)$', node.attrib.get('rel', ''))
|
||||||
|
if match:
|
||||||
|
player_id = match.groups()[0]
|
||||||
|
return (radio_domain, player_id)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DataPage(BasePage):
|
class DataPage(BasePage):
|
||||||
|
|
@ -123,7 +133,8 @@ class RadioFranceBrowser(BaseBrowser):
|
||||||
PAGES = {r'/playerjs/direct/donneesassociees/html\?guid=$': DataPage,
|
PAGES = {r'/playerjs/direct/donneesassociees/html\?guid=$': DataPage,
|
||||||
r'http://players.tv-radio.com/radiofrance/metadatas/([a-z]+)RSS.html': RssPage,
|
r'http://players.tv-radio.com/radiofrance/metadatas/([a-z]+)RSS.html': RssPage,
|
||||||
PlayerPage.URL: PlayerPage,
|
PlayerPage.URL: PlayerPage,
|
||||||
ReplayPage.URL: ReplayPage}
|
ReplayPage.URL: ReplayPage,
|
||||||
|
ReplayPage.URL2: ReplayPage}
|
||||||
|
|
||||||
def id2domain(self, _id):
|
def id2domain(self, _id):
|
||||||
"""
|
"""
|
||||||
|
|
@ -179,7 +190,7 @@ class RadioFranceBrowser(BaseBrowser):
|
||||||
match = re.match(PlayerPage.URL, url)
|
match = re.match(PlayerPage.URL, url)
|
||||||
if match:
|
if match:
|
||||||
radio_domain, replay_id = match.groups()
|
radio_domain, replay_id = match.groups()
|
||||||
elif re.match(ReplayPage.URL, url):
|
elif re.match(ReplayPage.URL, url) or re.match(ReplayPage.URL2, url):
|
||||||
self.location(url)
|
self.location(url)
|
||||||
assert self.is_on_page(ReplayPage)
|
assert self.is_on_page(ReplayPage)
|
||||||
radio_domain, replay_id = self.page.get_id()
|
radio_domain, replay_id = self.page.get_id()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue