optimize sync yyets

This commit is contained in:
Benny
2023-03-06 18:52:59 +01:00
parent ba369efdeb
commit df5d42a702
2 changed files with 6 additions and 4 deletions

View File

@@ -3,16 +3,16 @@ pytelegrambotapi==4.10.0
beautifulsoup4==4.11.2 beautifulsoup4==4.11.2
tgbot-ping==1.0.7 tgbot-ping==1.0.7
redis==4.5.1 redis==4.5.1
apscheduler==3.10.0 apscheduler==3.10.1
pymongo==4.3.3 pymongo==4.3.3
tornado==6.2 tornado==6.2
captcha==0.4 captcha==0.4
passlib==1.7.4 passlib==1.7.4
fakeredis==2.9.2 fakeredis==2.10.0
pytz==2022.7.1 pytz==2022.7.1
filetype==1.2.0 filetype==1.2.0
requests[socks] requests[socks]
tqdm==4.64.1 tqdm==4.65.0
retry==0.9.2 retry==0.9.2
pymysql==1.0.2 pymysql==1.0.2
git+https://github.com/tgbot-collection/python-akismet git+https://github.com/tgbot-collection/python-akismet

View File

@@ -197,6 +197,7 @@ class YYSub(BaseSync):
return int(x.ul.li.div.a["href"].split("/")[-1]) return int(x.ul.li.div.a["href"].split("/")[-1])
def run(self): def run(self):
logging.info("Starting to sync YYSub...")
structure = deepcopy(self.structure) structure = deepcopy(self.structure)
end = self.get_lastest_id() + 1 end = self.get_lastest_id() + 1
# end = 41566 # end = 41566
@@ -225,7 +226,8 @@ class YYSub(BaseSync):
logging.info("YYsub Finished") logging.info("YYsub Finished")
def insert_data(self, data): def insert_data(self, data):
self.yyets.insert_one(data) rid = data["data"]["info"]["id"]
self.yyets.update_one({"data.info.id": rid}, {"$set": data}, upsert=True)
if __name__ == '__main__': if __name__ == '__main__':