| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 # coding: utf-8 | 1 # coding: utf-8 |
| 2 | 2 |
| 3 # This file is part of the Adblock Plus web scripts, | 3 # This file is part of the Adblock Plus web scripts, |
| 4 # Copyright (C) 2006-2014 Eyeo GmbH | 4 # Copyright (C) 2006-2014 Eyeo GmbH |
| 5 # | 5 # |
| 6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify |
| 7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as |
| 8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. |
| 9 # | 9 # |
| 10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 275 except IOError, e: | 275 except IOError, e: |
| 276 error = e | 276 error = e |
| 277 time.sleep(5) | 277 time.sleep(5) |
| 278 raise error | 278 raise error |
| 279 | 279 |
| 280 def _getMozillaDownloadLink(galleryID): | 280 def _getMozillaDownloadLink(galleryID): |
| 281 """ | 281 """ |
| 282 gets download link for a Gecko add-on from the Mozilla Addons site | 282 gets download link for a Gecko add-on from the Mozilla Addons site |
| 283 """ | 283 """ |
| 284 url = 'https://services.addons.mozilla.org/en-US/firefox/api/1/addon/%s' % _ur lencode(galleryID) | 284 url = 'https://services.addons.mozilla.org/en-US/firefox/api/1/addon/%s' % _ur lencode(galleryID) |
| 285 contents = _urlopen(url).read() | 285 document = dom.parse(_urlopen(url)) |
| 286 document = dom.parseString(contents) | |
|
Wladimir Palant
2014/07/22 18:41:22
This isn't something you changed but please replac
Felix Dahlke
2014/07/23 04:52:17
Done.
| |
| 287 linkTags = document.getElementsByTagName('install') | 286 linkTags = document.getElementsByTagName('install') |
| 288 linkTag = linkTags[0] if len(linkTags) > 0 else None | 287 linkTag = linkTags[0] if len(linkTags) > 0 else None |
| 289 versionTags = document.getElementsByTagName('version') | 288 versionTags = document.getElementsByTagName('version') |
| 290 versionTag = versionTags[0] if len(versionTags) > 0 else None | 289 versionTag = versionTags[0] if len(versionTags) > 0 else None |
| 291 if linkTag and versionTag and linkTag.firstChild and versionTag.firstChild: | 290 if linkTag and versionTag and linkTag.firstChild and versionTag.firstChild: |
| 292 return (linkTag.firstChild.data, versionTag.firstChild.data) | 291 return (linkTag.firstChild.data, versionTag.firstChild.data) |
| 293 else: | 292 else: |
| 294 return (None, None) | 293 return (None, None) |
| 295 | 294 |
| 296 def _getGoogleDownloadLink(galleryID): | 295 def _getGoogleDownloadLink(galleryID): |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 391 if downloadURL == None: | 390 if downloadURL == None: |
| 392 continue | 391 continue |
| 393 if not result.has_section(repo.repositoryName): | 392 if not result.has_section(repo.repositoryName): |
| 394 result.add_section(repo.repositoryName) | 393 result.add_section(repo.repositoryName) |
| 395 result.set(repo.repositoryName, "downloadURL", downloadURL) | 394 result.set(repo.repositoryName, "downloadURL", downloadURL) |
| 396 result.set(repo.repositoryName, "version", version) | 395 result.set(repo.repositoryName, "version", version) |
| 397 | 396 |
| 398 qrcode = _getQRCode(downloadURL) | 397 qrcode = _getQRCode(downloadURL) |
| 399 if qrcode != None: | 398 if qrcode != None: |
| 400 result.set(repo.repositoryName, "qrcode", qrcode) | 399 result.set(repo.repositoryName, "qrcode", qrcode) |
| LEFT | RIGHT |