|
@@ -6,6 +6,7 @@ import traceback
|
|
|
from typing import List, Set, Dict, Tuple
|
|
|
|
|
|
from tqdm import tqdm
|
|
|
+from pymysql.cursors import DictCursor
|
|
|
|
|
|
from applications import WeixinSpider, longArticlesMySQL, log, bot
|
|
|
from applications.const import WeixinVideoCrawlerConst
|
|
@@ -31,7 +32,7 @@ class WeixinAccountCrawler(object):
|
|
|
:return:
|
|
|
"""
|
|
|
sql = "select distinct account_name from datastat_sort_strategy;"
|
|
|
- account_name_list = self.db_client.select_json(sql)
|
|
|
+ account_name_list = self.db_client.select(sql, cursor_type=DictCursor)
|
|
|
account_name_set = set()
|
|
|
for account_name_obj in account_name_list:
|
|
|
account_name_set.add(account_name_obj['account_name'])
|
|
@@ -47,7 +48,7 @@ class WeixinAccountCrawler(object):
|
|
|
FROM publish_single_video_source
|
|
|
WHERE source_account = {const.NEED_SCAN_SOURCE_ACCOUNT};
|
|
|
"""
|
|
|
- article_url_list = self.db_client.select_json(sql)
|
|
|
+ article_url_list = self.db_client.select(sql, cursor_type=DictCursor)
|
|
|
return article_url_list
|
|
|
|
|
|
def update_crawler_article_status(self, article_id_tuple: Tuple[int, ...]) -> int:
|
|
@@ -74,7 +75,7 @@ class WeixinAccountCrawler(object):
|
|
|
WHERE read_rate > {const.READ_AVG_MULTIPLE} and view_count > {const.MIN_READ_COUNT} and publish_timestamp > {publish_timestamp_threshold};
|
|
|
ORDER BY read_rate DESC;
|
|
|
"""
|
|
|
- title_list = self.db_client.select_json(sql)
|
|
|
+ title_list = self.db_client.select(sql, cursor_type=DictCursor)
|
|
|
title_list = [i['title'] for i in title_list]
|
|
|
return title_list
|
|
|
|