|
@@ -23,9 +23,9 @@ def tunnel_proxies():
|
|
|
password = "5zqcjkmy"
|
|
|
tunnel_proxies = {
|
|
|
"http": "http://%(user)s:%(pwd)s@%(proxy)s/"
|
|
|
- % {"user": username, "pwd": password, "proxy": tunnel},
|
|
|
+ % {"user": username, "pwd": password, "proxy": tunnel},
|
|
|
"https": "http://%(user)s:%(pwd)s@%(proxy)s/"
|
|
|
- % {"user": username, "pwd": password, "proxy": tunnel},
|
|
|
+ % {"user": username, "pwd": password, "proxy": tunnel},
|
|
|
}
|
|
|
|
|
|
return tunnel_proxies
|
|
@@ -45,25 +45,27 @@ class XiaoNianGaoAuthor:
|
|
|
# 每轮只抓取定量的数据,到达数量后自己退出
|
|
|
max_count = int(self.rule_dict.get("videos_cnt", {}).get("min", 300))
|
|
|
for user_dict in self.user_list:
|
|
|
- if self.download_count <= max_count:
|
|
|
- self.get_video_list(user_dict)
|
|
|
- # time.sleep(random.randint(1, 10))
|
|
|
- time.sleep(1)
|
|
|
- else:
|
|
|
- AliyunLogger.logging(
|
|
|
- code="2000",
|
|
|
- platform=self.platform,
|
|
|
- mode=self.mode,
|
|
|
- env=self.env,
|
|
|
- message="本轮已经抓取足够数量的视频,已经自动退出",
|
|
|
- )
|
|
|
- Common.logging(
|
|
|
- log_type=self.mode,
|
|
|
- crawler=self.platform,
|
|
|
- env=self.env,
|
|
|
- message="本轮已经抓取足够数量的视频,已经自动退出",
|
|
|
- )
|
|
|
- return
|
|
|
+ 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, 10))
|
|
|
+ time.sleep(1)
|
|
|
+ else:
|
|
|
+ AliyunLogger.logging(
|
|
|
+ code="2000",
|
|
|
+ platform=self.platform,
|
|
|
+ mode=self.mode,
|
|
|
+ env=self.env,
|
|
|
+ message="本轮已经抓取足够数量的视频,已经自动退出",
|
|
|
+ )
|
|
|
+ Common.logging(
|
|
|
+ log_type=self.mode,
|
|
|
+ crawler=self.platform,
|
|
|
+ env=self.env,
|
|
|
+ message="本轮已经抓取足够数量的视频,已经自动退出",
|
|
|
+ )
|
|
|
+ return
|
|
|
|
|
|
def get_video_list(self, user_dict):
|
|
|
next_t = -1
|
|
@@ -266,8 +268,11 @@ class XiaoNianGaoAuthor:
|
|
|
item=video_dict,
|
|
|
trace_id=trace_id,
|
|
|
)
|
|
|
- # try:
|
|
|
- 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()
|
|
|
if flag:
|
|
|
video_dict["width"] = video_dict["video_width"]
|
|
|
video_dict["height"] = video_dict["video_height"]
|