Explorar o código

视频号爬虫增加cursor判断

luojunhui hai 1 mes
pai
achega
db0d0105e4
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      tasks/crawler_channel_account_videos.py

+ 5 - 1
tasks/crawler_channel_account_videos.py

@@ -53,7 +53,11 @@ class CrawlerChannelAccountVideos:
         """
         get channel account list from database
         """
-        sql = f"""select account_id, max_cursor from sph_account_for_videos where status = {const.CHANNEL_ACCOUNT_GOOD_STATUS};"""
+        sql = f"""
+            select account_id, max_cursor 
+            from sph_account_for_videos 
+            where status = {const.CHANNEL_ACCOUNT_GOOD_STATUS}
+            order by max_cursor;"""
         account_list = self.db_client.fetch(query=sql, cursor_type=DictCursor)
         return account_list