Esempio n. 1
0
def query_img_info_func(next_page_href):
    print '------------------------------------------------------------------%d' % 1
    #thread = threading.Thread(target=thread_run,args=(resultJson,page))

    result = DataParser.parse_img_info(
        Downloader.fetch_next_page(next_page_href))
    #print result
    print '------------------------------------------------------------------%d' % 2
    return result
Esempio n. 2
0
 def query_img_info_by_content(img_path):
     result_json_list = []
     pool = ThreadPool(70)
     try:
         html = ContentDownloader.fetch_first_page(img_path)
         #print html
         img_list = DataParser.parse_img_info(html)
         #print img_list
         next_page_href_list = DataParser.parse_next_page_href(html)
         #print next_page_href_list
         result_json_list = pool.map(
             query_img_info_func, next_page_href_list)
         pool.close()
         pool.join()
         result_json_list = reduce(image_info_list_reduce, result_json_list)
         result_json_list = filter(image_info_list_filter, result_json_list)
         print 'Finish query.'
     except Exception, e:
         print e