浏览代码

远端返回格式修改

luojunhui 3 月之前
父节点
当前提交
48823c852f
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      tasks/crawler_accounts_by_association.py

+ 9 - 1
tasks/crawler_accounts_by_association.py

@@ -1867,7 +1867,15 @@ class ChannelsAccountCrawler(CrawlerAccounts):
 
         # fetch account video list for the first page
         search_video_response = get_channel_account_videos(account_id)
-        video_list = search_video_response["data"]["object"]
+        search_response_data = search_video_response["data"]
+        search_response_data_type = type(search_response_data)
+        if search_response_data_type == dict:
+            video_list = search_response_data["object"]
+        elif search_response_data_type == list:
+            video_list = search_response_data
+        else:
+            raise RuntimeError("search video response type error")
+
         title_list = [i['objectDesc']['description'] for i in video_list]
         title_list_str = json.dumps(title_list, ensure_ascii=False)
         self.process_channels_account(account_name, account_id, title_list_str)