|
@@ -12,7 +12,13 @@ def article_crawler_duplicate_filter(new_article_title, db_client) -> bool:
|
|
|
select_sql = f"""
|
|
|
select article_id from crawler_meta_article where title = '{new_article_title}';
|
|
|
"""
|
|
|
- response = db_client.select(select_sql)
|
|
|
+ if hasattr(db_client, "fetch"):
|
|
|
+ response = db_client.fetch(select_sql)
|
|
|
+ elif hasattr(db_client, "select"):
|
|
|
+ response = db_client.select(select_sql)
|
|
|
+ else:
|
|
|
+ raise AttributeError("db_client must has fetch or select method")
|
|
|
+
|
|
|
if response:
|
|
|
return True
|
|
|
else:
|
|
@@ -28,7 +34,13 @@ def video_crawler_duplicate_filter(new_video_title, db_client) -> bool:
|
|
|
select_sql = f"""
|
|
|
select article_title from publish_single_video_source where article_title = '{new_video_title}';
|
|
|
"""
|
|
|
- response = db_client.select(select_sql)
|
|
|
+ if hasattr(db_client, "fetch"):
|
|
|
+ response = db_client.fetch(select_sql)
|
|
|
+ elif hasattr(db_client, "select"):
|
|
|
+ response = db_client.select(select_sql)
|
|
|
+ else:
|
|
|
+ raise AttributeError("db_client must has fetch or select method")
|
|
|
+
|
|
|
if response:
|
|
|
return True
|
|
|
else:
|