Commit 41446ab6 authored by zhanglu's avatar zhanglu

pin抓取

parent 95cbdda7
......@@ -9,7 +9,7 @@ from alpha_types.venus import ERROR as CODES
from alpha_types.venus import GRAP_PLATFORM
ins_account_cache = "ins_account_cache"
topic_id_cache = "ins_account_cache"
class CreateTopicForBatch(BaseView):
......@@ -69,12 +69,19 @@ class CreateTopicForBatch(BaseView):
not_exists_ids = []
topic_list = []
if platform == GRAP_PLATFORM.INS:
cache_key = topic_id_cache
elif platform == GRAP_PLATFORM.PIN:
cache_key = topic_id_cache + ":2"
else:
return
if platform in (GRAP_PLATFORM.INS, GRAP_PLATFORM.PIN):
for item in topics:
_id = item.get("id")
if not _id:
continue
exists = ins_cache.sismember(ins_account_cache, _id)
exists = ins_cache.sismember(cache_key, _id)
if exists:
continue
......@@ -121,7 +128,7 @@ class CreateTopicForBatch(BaseView):
# 将已经跑了的数据添加到缓存
if not_exists_ids:
ins_cache.sadd(ins_account_cache, *not_exists_ids)
ins_cache.sadd(cache_key, *not_exists_ids)
return self.ok(data=result)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment