|
@@ -11,6 +11,7 @@ from common.mq import MQ
|
|
sys.path.append(os.getcwd())
|
|
sys.path.append(os.getcwd())
|
|
from common.pipeline import PiaoQuanPipelineTest
|
|
from common.pipeline import PiaoQuanPipelineTest
|
|
from common.public import get_config_from_mysql, clean_title
|
|
from common.public import get_config_from_mysql, clean_title
|
|
|
|
+from common.scheduling_db import MysqlHelper
|
|
|
|
|
|
|
|
|
|
def tunnel_proxies():
|
|
def tunnel_proxies():
|
|
@@ -44,13 +45,16 @@ class XiaoNianGaoAuthor:
|
|
# 每轮只抓取定量的数据,到达数量后自己退出
|
|
# 每轮只抓取定量的数据,到达数量后自己退出
|
|
max_count = int(self.rule_dict.get("videos_cnt", {}).get("min", 300))
|
|
max_count = int(self.rule_dict.get("videos_cnt", {}).get("min", 300))
|
|
for user_dict in self.user_list:
|
|
for user_dict in self.user_list:
|
|
- if self.download_count <= max_count:
|
|
|
|
- self.get_video_list(user_dict)
|
|
|
|
- time.sleep(random.randint(1, 15))
|
|
|
|
- else:
|
|
|
|
- message = "本轮已经抓取足够数量的视频,已经自动退出"
|
|
|
|
- print(message)
|
|
|
|
- return
|
|
|
|
|
|
+ print(user_dict)
|
|
|
|
+ account_level = user_dict['account_level']
|
|
|
|
+ if account_level and account_level != "P3":
|
|
|
|
+ if self.download_count <= max_count:
|
|
|
|
+ self.get_video_list(user_dict)
|
|
|
|
+ time.sleep(random.randint(1, 15))
|
|
|
|
+ else:
|
|
|
|
+ message = "本轮已经抓取足够数量的视频,已经自动退出"
|
|
|
|
+ print(message)
|
|
|
|
+ return
|
|
|
|
|
|
def get_video_list(self, user_dict):
|
|
def get_video_list(self, user_dict):
|
|
next_t = -1
|
|
next_t = -1
|
|
@@ -179,7 +183,12 @@ class XiaoNianGaoAuthor:
|
|
item=video_dict,
|
|
item=video_dict,
|
|
trace_id=trace_id,
|
|
trace_id=trace_id,
|
|
)
|
|
)
|
|
- flag = pipeline.process_item()
|
|
|
|
|
|
+ account_level = user_dict['account_level']
|
|
|
|
+ if account_level == "P0" or account_level == "P1":
|
|
|
|
+ flag = True
|
|
|
|
+ else:
|
|
|
|
+ flag = pipeline.process_item()
|
|
|
|
+ # flag = pipeline.process_item()
|
|
if flag:
|
|
if flag:
|
|
video_dict["width"] = video_dict["video_width"]
|
|
video_dict["width"] = video_dict["video_width"]
|
|
video_dict["height"] = video_dict["video_height"]
|
|
video_dict["height"] = video_dict["video_height"]
|
|
@@ -195,11 +204,17 @@ class XiaoNianGaoAuthor:
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if __name__ == "__main__":
|
|
|
|
+ select_user_sql = (
|
|
|
|
+ f"""select * from crawler_user_v3 where task_id=21"""
|
|
|
|
+ )
|
|
|
|
+ user_list = MysqlHelper.get_values(
|
|
|
|
+ "author", "xiaoniangao", select_user_sql, "prod", ""
|
|
|
|
+ )
|
|
XNGA = XiaoNianGaoAuthor(
|
|
XNGA = XiaoNianGaoAuthor(
|
|
platform="xiaoniangao",
|
|
platform="xiaoniangao",
|
|
mode="author",
|
|
mode="author",
|
|
rule_dict={},
|
|
rule_dict={},
|
|
env="prod",
|
|
env="prod",
|
|
- user_list=[{"link": 295640510, "uid": "12334"}],
|
|
|
|
|
|
+ user_list=user_list
|
|
)
|
|
)
|
|
XNGA.get_author_list()
|
|
XNGA.get_author_list()
|