|
@@ -7,7 +7,7 @@ import time
|
|
|
|
|
|
from tqdm import tqdm
|
|
|
|
|
|
-from applications import WeixinSpider, Functions, DeNetMysql, PQMySQL
|
|
|
+from applications import WeixinSpider, Functions, DeNetMysql, longArticlesMySQL
|
|
|
|
|
|
|
|
|
class weixinCategory(object):
|
|
@@ -16,7 +16,7 @@ class weixinCategory(object):
|
|
|
"""
|
|
|
|
|
|
def __init__(self):
|
|
|
- self.db_client_pq = PQMySQL()
|
|
|
+ self.db_client_lam = longArticlesMySQL
|
|
|
self.db_client_dt = DeNetMysql()
|
|
|
self.spider = WeixinSpider()
|
|
|
self.function = Functions()
|
|
@@ -28,11 +28,11 @@ class weixinCategory(object):
|
|
|
:return:
|
|
|
"""
|
|
|
sql = f"""
|
|
|
- select distinct gh_id, account_source, account_name, account_category, latest_update_time
|
|
|
+ select gh_id, account_source, account_name, account_category, latest_update_time
|
|
|
from long_articles_accounts
|
|
|
- where account_category = '{account_category}';
|
|
|
+ where account_category = '{account_category}' and is_using = 1;
|
|
|
"""
|
|
|
- account_tuple = self.db_client_pq.select(sql)
|
|
|
+ account_tuple = self.db_client_lam.select(sql)
|
|
|
result = [
|
|
|
{
|
|
|
"gh_id": i[0],
|
|
@@ -104,7 +104,7 @@ class weixinCategory(object):
|
|
|
set latest_update_time = %s
|
|
|
where gh_id = %s;
|
|
|
"""
|
|
|
- self.db_client_pq.update(sql=update_sql, params=(dt_str, gh_id))
|
|
|
+ self.db_client_lam.update(sql=update_sql, params=(dt_str, gh_id))
|
|
|
|
|
|
def updateEachAccountArticles(self, gh_id, category, latest_time_stamp, index=None):
|
|
|
"""
|
|
@@ -138,12 +138,7 @@ class weixinCategory(object):
|
|
|
if __name__ == "__main__":
|
|
|
wxCategory = weixinCategory()
|
|
|
category_list = [
|
|
|
- '军事',
|
|
|
- '历史',
|
|
|
- '娱乐八卦',
|
|
|
- '情感生活',
|
|
|
- '健康养生',
|
|
|
- # '新闻媒体'
|
|
|
+ 'daily-account-mining'
|
|
|
]
|
|
|
for category in category_list:
|
|
|
account_list = wxCategory.getAccountList(category)
|