def get_keywords(self): try: keywords = [] # 连接数据库 db = DB_connection('localhost', 3306, 'root', '123123', 'All_Scraper', 'utf8') conn = db.connects() mapper = DB_operation(conn) # 将url提取出来 sql_get_keywords = "SELECT keyword FROM All_Scraper.search_keywords limit 100;" keywords = mapper.select(sql_get_keywords) conn.commit() conn.close() return keywords except Exception as err: print err
def get_review_ProductId(self): try: Product_Id = [] # 连接数据库 db = DB_connection('localhost', 3306, 'root', '123123', 'All_Scraper', 'utf8') conn = db.connects() mapper = DB_operation(conn) # 将url提取出来 sql_get_ProductId_url = "SELECT sku FROM All_Scraper.jd_keywords;" Product_Id = mapper.select(sql_get_ProductId_url) conn.commit() conn.close() return Product_Id except Exception as err: print err
def get_sellerpage_Url(self): try: sellerpage_Url = [] # 连接数据库 db = DB_connection('localhost', 3306, 'root', '123123', 'All_Scraper', 'utf8') conn = db.connects() mapper = DB_operation(conn) # 将url提取出来 sql_get_sellerpage_Url = "SELECT shop_id FROM All_Scraper.jd_products;" sellerpage_Url = mapper.select(sql_get_sellerpage_Url) conn.commit() conn.close() return sellerpage_Url except Exception as err: print err