def main(): grab_htmls = [ '/over-ear?all=true&dynamic_page_content_id=5094', '/on-ear?all=true&dynamic_page_content_id=5111', '/bluetooth-headsets?all=true&dynamic_page_content_id=4818', ] result_list = [] for grab_html in grab_htmls: result_list += get_item_list(grab_html) smart_csv('sennheiser.csv', result_list)
def main(): grab_htmls = [ ['CT30009700', 2], ['CT30013860', 2], ['CT30000200', 4], ['CT10000033', 5], ] result_list = [] for grab_html in grab_htmls: for index in range(grab_html[1]): result_list += get_item_list(index + 1, grab_html[0]) smart_csv('lg.csv', result_list)
def main(): result_list = [] for i in range(57): try_time = 3 item_info = None while try_time: try: item_info = get_item_info(i + 1) break except Exception: sleep(3) try_time -= 1 if try_time: print(i + 1, '出错重爬') else: print(i + 1, '停止爬取') if item_info: result_list.append(item_info) smart_csv('b2b.aocmonitor.csv', result_list)
def main(): result_list = [] for index in range(13): result_list += get_item_list(index + 1) smart_csv('lenovo.csv', result_list)
def main(): result_list = [] for i in range(7): result_list += get_item_list(i) smart_csv('crucial.csv', result_list)
def main(): result_list = [] for i in range(12): result_list += get_item_list(i + 1) smart_csv('aocmonitor.csv', result_list)
def main(): result_list = [] index_list = [26779, 26781, 26782, 26783, 26788] for index in index_list: result_list += get_item_list(index) smart_csv('dell.csv', result_list)
def main(): result_list = [] for i in range(30): result_list += get_item_list(i+1) smart_csv('colorful.csv', result_list)