Python 2.5 compatibility
This commit is contained in:
parent
bfb3689456
commit
664e4cc094
2 changed files with 12 additions and 2 deletions
|
|
@ -22,6 +22,11 @@ import re
|
||||||
import urlparse
|
import urlparse
|
||||||
from logging import warning, debug
|
from logging import warning, debug
|
||||||
|
|
||||||
|
try:
|
||||||
|
from urlparse import parse_qs
|
||||||
|
except ImportError:
|
||||||
|
from cgi import parse_qs
|
||||||
|
|
||||||
from weboob.tools.misc import html2text, get_bytes_size
|
from weboob.tools.misc import html2text, get_bytes_size
|
||||||
from weboob.capabilities.torrent import Torrent
|
from weboob.capabilities.torrent import Torrent
|
||||||
from weboob.capabilities.base import NotLoaded
|
from weboob.capabilities.base import NotLoaded
|
||||||
|
|
@ -84,7 +89,7 @@ class TorrentsPage(BasePage):
|
||||||
else:
|
else:
|
||||||
title = tds[i].find('a').text
|
title = tds[i].find('a').text
|
||||||
url = urlparse.urlparse(tds[i].find('a').attrib['href'])
|
url = urlparse.urlparse(tds[i].find('a').attrib['href'])
|
||||||
params = urlparse.parse_qs(url.query)
|
params = parse_qs(url.query)
|
||||||
if 'torrentid' in params:
|
if 'torrentid' in params:
|
||||||
id = '%s.%s' % (params['id'][0], params['torrentid'][0])
|
id = '%s.%s' % (params['id'][0], params['torrentid'][0])
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,11 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import simplejson as json
|
import simplejson as json
|
||||||
|
|
||||||
|
try:
|
||||||
|
from urlparse import parse_qs
|
||||||
|
except ImportError:
|
||||||
|
from cgi import parse_qs
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['RadioFranceBrowser', 'RadioFranceVideo']
|
__all__ = ['RadioFranceBrowser', 'RadioFranceVideo']
|
||||||
|
|
||||||
|
|
@ -57,7 +62,7 @@ class PlayerPage(BasePage):
|
||||||
def get_url(self):
|
def get_url(self):
|
||||||
radio_id = self.groups[0]
|
radio_id = self.groups[0]
|
||||||
player = self.parser.select(self.document.getroot(), '#rfPlayer embed', 1)
|
player = self.parser.select(self.document.getroot(), '#rfPlayer embed', 1)
|
||||||
urlparams = urlparse.parse_qs(player.attrib['src'])
|
urlparams = parse_qs(player.attrib['src'])
|
||||||
return 'http://www.%s.fr/%s' % (radio_id, urlparams['urlAOD'][0])
|
return 'http://www.%s.fr/%s' % (radio_id, urlparams['urlAOD'][0])
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue