-
-
Save anonymous/521c52b51e5d6c97c17790a67eeccf4a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_real_download_url(url): | |
try: | |
# 获取真实下载地址 | |
browser = webdriver.PhantomJS(executable_path="./phantomjs") | |
browser.get(url) | |
# 点击跳转页面,获取真实下载页面 | |
ele = browser.find_element_by_id("free_down_link") | |
ele.click() | |
# 获取真实下载地址元素 | |
real_down = browser.find_element_by_id("free_down_link") | |
# 解析真实下载地址 | |
real_down_url = real_down.get_attribute("onclick").split("'")[1] | |
except Exception as e: | |
print(e) | |
browser.quit() | |
print("获取下载地址失败") | |
return "" | |
else: | |
browser.quit() | |
return real_down_url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment