我正在尝试获取下载链接并下载文件。
我有一个包含以下链接的日志文件:
http://www.downloadcrew.com/article/18631-aida64
http://www.downloadcrew.com/article/4475-sumo
http://www.downloadcrew.com/article/2174-iolo_system_mechanic_professional
...
...
我有这样的代码:
import urllib, time
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
f = open("dcrewtest.txt")
for line in f.readlines():
    try:
        driver.find_element_by_xpath("//div/div[2]/div[2]/div[2]/div[3]/div/a/img").click()
        time.sleep(8)
    except:
        pass 
     url = line.encode
     pageurl = urllib.urlopen(url).read()
     soup = BeautifulSoup(pageurl)
     for a in soup.select("h1#articleTitle"):
         print a.contents[0].strip()
     for b in soup.findAll("th"):
         if b.text == "Date Updated:":
            print b.parent.td.text
         elif b.text == "Developer:":
            print c.parent.td.text
到目前为止,我不知道如何获取下载链接并下载它。是否可以使用硒下载文件?