0
由于我找不到任何关于此的有用信息,我决定将它放在这里。使用python selenium&firefox处理磁链接
我想通过使用python selenium & firefox自动下载山洪。一切工作正常,直到磁铁链接“打开”的点,一旦发生脚本简单地冻结。
我最好的猜测是磁铁链接并没有像http链接那样“加载”,但我不知道如何解决这个问题。
def lookup_and_download(query):
#Focus Search box
elem = browser.find_element_by_name('q')
#Send Search Query
elem.send_keys(query[0] + Keys.RETURN)
#Select correct download link & start download
element = browser.find_element_by_xpath(
".//*[contains(@title,query[1])
and contains(@title,'eztv')]/../../*[@title=
'Download this torrent using magnet']")
url = element.get_attribute("href")
browser.get(url)
我想,当然多次调用此函数,但它正好在browser.get(url)
行冻结。然而,一个下载确实有效。
main/base url? –
browser.get('http://thepiratebay.se/recent') – Daquicker