cobweb-launcher 1.2.19__py3-none-any.whl → 1.2.20__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cobweb-launcher might be problematic. Click here for more details.
- cobweb/db/api_db.py +2 -2
- cobweb/launchers/launcher_api.py +3 -9
- {cobweb_launcher-1.2.19.dist-info → cobweb_launcher-1.2.20.dist-info}/METADATA +1 -1
- {cobweb_launcher-1.2.19.dist-info → cobweb_launcher-1.2.20.dist-info}/RECORD +7 -7
- {cobweb_launcher-1.2.19.dist-info → cobweb_launcher-1.2.20.dist-info}/LICENSE +0 -0
- {cobweb_launcher-1.2.19.dist-info → cobweb_launcher-1.2.20.dist-info}/WHEEL +0 -0
- {cobweb_launcher-1.2.19.dist-info → cobweb_launcher-1.2.20.dist-info}/top_level.txt +0 -0
cobweb/db/api_db.py
CHANGED
|
@@ -62,8 +62,8 @@ class ApiDB:
|
|
|
62
62
|
def lock(self, name, t=15) -> bool:
|
|
63
63
|
return self._get_response(api="/lock", params=dict(name=name, t=t))
|
|
64
64
|
|
|
65
|
-
def
|
|
66
|
-
return self._get_response(api="/
|
|
65
|
+
def auto_incr(self, name, t=15, limit=1000) -> bool:
|
|
66
|
+
return self._get_response(api="/auto_incr", params=dict(name=name, t=t, limit=limit))
|
|
67
67
|
|
|
68
68
|
def members(self, name, score, start=0, count=5000, _min="-inf", _max="+inf"):
|
|
69
69
|
return self._get_response(api="/members", params=dict(name=name, score=score, start=start, count=count, min=_min, max=_max))
|
cobweb/launchers/launcher_api.py
CHANGED
|
@@ -46,18 +46,12 @@ class LauncherApi(Launcher):
|
|
|
46
46
|
设置时间窗口为self._time_window(秒),判断在该窗口内的采集量是否满足阈值(self._spider_max_speed)
|
|
47
47
|
:return: True -> 种子, False -> None
|
|
48
48
|
"""
|
|
49
|
-
|
|
50
|
-
if int(spider_speed or 0) > self._spider_max_count:
|
|
49
|
+
if not self._db.auto_incr(self._speed_control_key, t=self._time_window, limit=self._spider_max_count):
|
|
51
50
|
expire_time = self._db.ttl(self._speed_control_key)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
elif expire_time and expire_time > 0:
|
|
55
|
-
logger.info(f"Too fast! Please wait {expire_time} seconds...")
|
|
56
|
-
time.sleep(expire_time / 2)
|
|
51
|
+
logger.info(f"Too fast! Please wait {expire_time} seconds...")
|
|
52
|
+
time.sleep(expire_time / 2)
|
|
57
53
|
return None
|
|
58
54
|
seed = self.__LAUNCHER_QUEUE__["todo"].pop()
|
|
59
|
-
if seed:
|
|
60
|
-
self._db.auto_incrby(self._speed_control_key, t=self._time_window)
|
|
61
55
|
return seed
|
|
62
56
|
|
|
63
57
|
@check_pause
|
|
@@ -14,14 +14,14 @@ cobweb/crawlers/base_crawler.py,sha256=ee_WSDnPQpPTk6wlFuY2UEx5L3hcsAZFcr6i3GLSr
|
|
|
14
14
|
cobweb/crawlers/crawler.py,sha256=xiFNM0t69f5xlm59hPbO2MpqtdirVAUhD84-CLpyHPM,6349
|
|
15
15
|
cobweb/crawlers/file_crawler.py,sha256=2Sjbdgxzqd41WykKUQE3QQlGai3T8k-pmHNmPlTchjQ,4454
|
|
16
16
|
cobweb/db/__init__.py,sha256=uZwSkd105EAwYo95oZQXAfofUKHVIAZZIPpNMy-hm2Q,56
|
|
17
|
-
cobweb/db/api_db.py,sha256=
|
|
17
|
+
cobweb/db/api_db.py,sha256=646diIcZxdO0lfev958PZ-hTm5BmtJ0ns50nZOjlXOc,2865
|
|
18
18
|
cobweb/db/redis_db.py,sha256=fumNZJiio-uQqRcSrymx8eJ1PqsdOwITe_Y-9JOXxrQ,4298
|
|
19
19
|
cobweb/exceptions/__init__.py,sha256=E9SHnJBbhD7fOgPFMswqyOf8SKRDrI_i25L0bSpohvk,32
|
|
20
20
|
cobweb/exceptions/oss_db_exception.py,sha256=iP_AImjNHT3-Iv49zCFQ3rdLnlvuHa3h2BXApgrOYpA,636
|
|
21
21
|
cobweb/launchers/__init__.py,sha256=qMuVlQcjErVK67HyKFZEsXf_rfZD5ODjx1QucSCKMOM,114
|
|
22
22
|
cobweb/launchers/launcher.py,sha256=SK4f3Fpuv-QMMriHruXGQ1sh1lxT1DZ2PdG0p2wAzNw,6978
|
|
23
23
|
cobweb/launchers/launcher_air.py,sha256=KAk_M8F3029cXYe7m4nn3Nzyi89lbxJ2cqZjqW8iZ0E,2832
|
|
24
|
-
cobweb/launchers/launcher_api.py,sha256=
|
|
24
|
+
cobweb/launchers/launcher_api.py,sha256=YyqOt2z3TDVvrcguPhKN5SGRfc7B25KfaYhNNmwtpzc,8577
|
|
25
25
|
cobweb/launchers/launcher_pro.py,sha256=2JdN4khAFGBWLXDKaWknjG72XBhfTAnwtrgVmkF0K3M,8653
|
|
26
26
|
cobweb/pipelines/__init__.py,sha256=zSUsGtx6smbs2iXBXvYynReKSgky-3gjqaAtKVnA_OU,105
|
|
27
27
|
cobweb/pipelines/base_pipeline.py,sha256=fYnWf79GmhufXpcnMa3te18SbmnVeYLwxfyo-zLd9CY,1577
|
|
@@ -33,8 +33,8 @@ cobweb/utils/__init__.py,sha256=vBtZTy3EfRE0MmH43URhmr7nw6_oOWTEbGOM9xR_9o8,78
|
|
|
33
33
|
cobweb/utils/bloom.py,sha256=vng-YbKgh9HbtpAWYf_nkUSbfVTOj40aqUUejRYlsCU,1752
|
|
34
34
|
cobweb/utils/oss.py,sha256=gyt8-UB07tVphZLQXMOf-JTJwU-mWq8KZkOXKkAf3uk,3513
|
|
35
35
|
cobweb/utils/tools.py,sha256=5JEaaAwYoV9Sdla2UBIJn6faUBuXmxUMagm9ck6FVqs,1253
|
|
36
|
-
cobweb_launcher-1.2.
|
|
37
|
-
cobweb_launcher-1.2.
|
|
38
|
-
cobweb_launcher-1.2.
|
|
39
|
-
cobweb_launcher-1.2.
|
|
40
|
-
cobweb_launcher-1.2.
|
|
36
|
+
cobweb_launcher-1.2.20.dist-info/LICENSE,sha256=z1rxSIGOyzcSb3orZxFPxzx-0C1vTocmswqBNxpKfEk,1063
|
|
37
|
+
cobweb_launcher-1.2.20.dist-info/METADATA,sha256=4uzzU0B4JmMbwR6U3pdNY8rBQ9m6tzwjUzC_d4iO6k8,6510
|
|
38
|
+
cobweb_launcher-1.2.20.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92
|
|
39
|
+
cobweb_launcher-1.2.20.dist-info/top_level.txt,sha256=4GETBGNsKqiCUezmT-mJn7tjhcDlu7nLIV5gGgHBW4I,7
|
|
40
|
+
cobweb_launcher-1.2.20.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|