def main():
with open('ca_dlink_filelist.csv', 'w') as fout:
cw = csv.writer(fout)
cw.writerow(['model', 'rev', 'fw_ver', 'fw_url', 'date', 'fsize', 'sha1', 'md5'])
global executor
executor = futures.ThreadPoolExecutor()
d = pq(url='http://support.dlink.ca/AllPro.aspx?type=all')
# all 442 models
models = [_.text_content().strip() for _ in d('tr > td:nth-child(1) > .aRedirect')]
for model in models:
prod_url = 'http://support.dlink.ca/ProductInfo.aspx?m=%s'%parse.quote(model)
crawl_prod(prod_url, model)
print('wait for Executor shutdown')
executor.shutdown(True)
评论列表
文章目录