def walkFirmwares(response, product):
try:
root = html.fromstring(response.text)
firmwares = root.xpath("//div[@id='LargeFirmware']//a")
for iFirm, firmware in enumerate(firmwares):
text = firmware.xpath(".//text()")
if "firmware" in " ".join(text).lower():
# print('Firmware="%s", iFirmware=%d'%(text, iFirm))
desc = text[0]
href = firmware.xpath("./@data-durl")
if not href:
href = firmware.xpath("./@href")
url = href[0]
model = product.xpath(".//text()")[0]
print('model="%s", desc="%s", url=%s'%(model, desc, url))
global executor, visited
if url in visited:
continue
visited[url] = (model,desc)
executor.submit(download_file, model, desc, url)
except BaseException as ex:
traceback.print_exc()
netgear_form_submit_crawler.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录