On GeckoDriver and OperaChromiumDriver, the fallback download URL when the GitHub API call fails is wrong and it doesn't download well.
The error was caused by the following source code.
resp = requests.get(gecko_driver_version_release_ui_url, allow_redirects=True)
if resp.status_code == 200:
json_data = {"assets": []}
soup = BeautifulSoup(resp.text, features="html.parser")
urls = [resp.url + a['href'] for a in soup.find_all('a', href=True) if r"/download/" in a['href']]
When I ran it, the value of resp.url was https://github.com/mozilla/geckodriver/releases/tag/v0.26.0, and the value of a['href'] was /mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz.
On GeckoDriver and OperaChromiumDriver, the fallback download URL when the GitHub API call fails is wrong and it doesn't download well.
The error was caused by the following source code.
When I ran it, the value of
resp.url
washttps://github.com/mozilla/geckodriver/releases/tag/v0.26.0
, and the value ofa['href']
was/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz
.So, I modified it as follows.
Before Fix
resp.url + a['href'] → 'https://github.com/mozilla/geckodriver/releases/tag/v0.26.0/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz'
After Fix
urljoin(resp.url, a['href']) → 'https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz'
If you're okay with it, please merge this PR.