|
@@ -50,3 +50,38 @@ def insert_into_single_video_source_table(db_client, video_item):
|
|
|
"oss_path": video_item["video_oss_path"],
|
|
|
},
|
|
|
)
|
|
|
+
|
|
|
+def insert_into_video_meta_accounts_table(db_client, account_item):
|
|
|
+ """
|
|
|
+ insert account into account meta table
|
|
|
+ """
|
|
|
+ insert_sql = f"""
|
|
|
+ insert into video_meta_accounts
|
|
|
+ (platform, account_id, account_name, max_cursor, account_init_date, status, priority)
|
|
|
+ values
|
|
|
+ (%s, %s, %s, %s, %s, %s, %s);
|
|
|
+ """
|
|
|
+ try:
|
|
|
+ db_client.save(
|
|
|
+ query=insert_sql,
|
|
|
+ params=(
|
|
|
+ account_item["platform"],
|
|
|
+ account_item["account_id"],
|
|
|
+ account_item["account_name"],
|
|
|
+ account_item["max_cursor"],
|
|
|
+ account_item["account_init_date"],
|
|
|
+ account_item["status"],
|
|
|
+ account_item["priority"],
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ except Exception as e:
|
|
|
+ log(
|
|
|
+ task="{}_account_crawler".format(account_item["platform"]),
|
|
|
+ function="save_each_account",
|
|
|
+ message="save account failed",
|
|
|
+ data={
|
|
|
+ "error": str(e),
|
|
|
+ "traceback": traceback.format_exc(),
|
|
|
+ "account_id": account_item["account_id"],
|
|
|
+ },
|
|
|
+ )
|