|
@@ -34,8 +34,7 @@ class HotSearch:
|
|
|
source = "百度"
|
|
|
title = title_html.xpath("./text()")[0].strip()
|
|
|
publish_time = cls.today
|
|
|
- insert_sql = f"""insert into crawler_hot_title(source, title, publish_time)
|
|
|
- values("{source}", '{title}', "{publish_time}")"""
|
|
|
+ insert_sql = f"""insert into crawler_hot_title(source, title, publish_time) values("{source}", '{title}', "{publish_time}")"""
|
|
|
Common.logger(log_type, crawler).info(f"insert_sql:{insert_sql}")
|
|
|
MysqlHelper.update_values(log_type, crawler, insert_sql, env, action="")
|
|
|
Common.logger(log_type, crawler).info("写入数据库成功\n")
|
|
@@ -70,8 +69,7 @@ class HotSearch:
|
|
|
|
|
|
title = tr.xpath("./td[2]/*[1]/text()")[0].strip()
|
|
|
|
|
|
- insert_sql = f"""insert into crawler_hot_title(source, title, publish_time)
|
|
|
- values("{source}", '{title}', "{publish_time}")"""
|
|
|
+ insert_sql = f"""insert into crawler_hot_title(source, title, publish_time) values("{source}", '{title}', "{publish_time}")"""
|
|
|
Common.logger(log_type, crawler).info(f"insert_sql:{insert_sql}")
|
|
|
MysqlHelper.update_values(log_type, crawler, insert_sql, env, action="")
|
|
|
Common.logger(log_type, crawler).info("写入数据库成功\n")
|
|
@@ -110,8 +108,7 @@ class HotSearch:
|
|
|
# print(title)
|
|
|
# print('\n')
|
|
|
|
|
|
- insert_sql = f"""insert into crawler_hot_title(source, title, publish_time)
|
|
|
- values("{source}", '{title}', "{publish_time}")"""
|
|
|
+ insert_sql = f"""insert into crawler_hot_title(source, title, publish_time) values("{source}", '{title}', "{publish_time}")"""
|
|
|
Common.logger(log_type, crawler).info(f"insert_sql:{insert_sql}")
|
|
|
MysqlHelper.update_values(log_type, crawler, insert_sql, env, action="")
|
|
|
Common.logger(log_type, crawler).info("写入数据库成功\n")
|
|
@@ -149,8 +146,7 @@ class HotSearch:
|
|
|
# print(publish_time)
|
|
|
# print(title)
|
|
|
|
|
|
- insert_sql = f"""insert into crawler_hot_title(source, title, publish_time)
|
|
|
- values("{source}", '{title}', "{publish_time}")"""
|
|
|
+ insert_sql = f"""insert into crawler_hot_title(source, title, publish_time) values("{source}", '{title}', "{publish_time}")"""
|
|
|
Common.logger(log_type, crawler).info(f"insert_sql:{insert_sql}")
|
|
|
MysqlHelper.update_values(log_type, crawler, insert_sql, env, action="")
|
|
|
Common.logger(log_type, crawler).info("写入数据库成功\n")
|
|
@@ -188,8 +184,7 @@ class HotSearch:
|
|
|
# print(publish_time)
|
|
|
# print(title)
|
|
|
|
|
|
- insert_sql = f"""insert into crawler_hot_title(source, title, publish_time)
|
|
|
- values("{source}", '{title}', "{publish_time}")"""
|
|
|
+ insert_sql = f"""insert into crawler_hot_title(source, title, publish_time) values("{source}", '{title}', "{publish_time}")"""
|
|
|
Common.logger(log_type, crawler).info(f"insert_sql:{insert_sql}")
|
|
|
MysqlHelper.update_values(log_type, crawler, insert_sql, env, action="")
|
|
|
Common.logger(log_type, crawler).info("写入数据库成功\n")
|
|
@@ -198,9 +193,9 @@ class HotSearch:
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
- # HotSearch.baidu_hot_search("hot-search-baidu", "weixinzhishu", "dev")
|
|
|
- # HotSearch.douyin_hot_search("hot-search-douyin", "weixinzhishu", "dev")
|
|
|
- # HotSearch.kuaishou_hot_search("hot-search-kuaishou", "weixinzhishu", "dev")
|
|
|
- # HotSearch.weibo_hot_search("hot-search-weibo", "weixinzhishu", "dev")
|
|
|
- HotSearch.weixin_hot_search("hot-search-weixin", "weixinzhishu", "dev")
|
|
|
+ HotSearch.baidu_hot_search("hot-search", "weixinzhishu", "dev")
|
|
|
+ HotSearch.douyin_hot_search("hot-search", "weixinzhishu", "dev")
|
|
|
+ HotSearch.kuaishou_hot_search("hot-search", "weixinzhishu", "dev")
|
|
|
+ HotSearch.weibo_hot_search("hot-search", "weixinzhishu", "dev")
|
|
|
+ HotSearch.weixin_hot_search("hot-search", "weixinzhishu", "dev")
|
|
|
|