Commit f982ecfe by Nicolas Joyard

Grml

parent b358c89d
Showing with 3 additions and 2 deletions
...@@ -30,14 +30,15 @@ def fetch_an(job, **kwargs): ...@@ -30,14 +30,15 @@ def fetch_an(job, **kwargs):
raise Exception('Téléchargement %s impossible' % url) raise Exception('Téléchargement %s impossible' % url)
def match_link(a): def match_link(a):
return a['href'].endswith('.json.zip') return a['href'].endswith('.json.zip') or \
a['href'].endswith('.json.zip ')
try: try:
link = [a for a in soup.select('a[href]') if match_link(a)][0] link = [a for a in soup.select('a[href]') if match_link(a)][0]
except Exception: except Exception:
raise Exception('Lien vers dump .json.zip introuvable') raise Exception('Lien vers dump .json.zip introuvable')
jsonzip_url = link['href'] jsonzip_url = link['href'].replace('.json.zip ', '.json.zip')
if jsonzip_url.startswith('/'): if jsonzip_url.startswith('/'):
jsonzip_url = '%s%s' % (BASE_URL, jsonzip_url) jsonzip_url = '%s%s' % (BASE_URL, jsonzip_url)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment