fix: 修复可能导致脚本重复运行的问题
This commit is contained in:
parent
e9d94961fa
commit
027b1f597d
10
mas2ff2.py
10
mas2ff2.py
@ -157,15 +157,13 @@ def run(instance, access_token, fanfou_cookie, fanfou_token):
|
||||
|
||||
time.sleep(10)
|
||||
|
||||
while True:
|
||||
requests.get('https://up.tunpok.com/api/push/sQLwSpeiUH?msg=OK&ping=')
|
||||
# get new status
|
||||
# get every new status
|
||||
while min_id:
|
||||
me_timeline = mastodon_cli.account_statuses(
|
||||
me_id, exclude_replies=True, min_id=min_id)
|
||||
# if no new status
|
||||
if not me_timeline:
|
||||
time.sleep(10)
|
||||
continue
|
||||
break
|
||||
statuses = []
|
||||
for status in me_timeline:
|
||||
statuses.append(status)
|
||||
@ -185,6 +183,8 @@ def run(instance, access_token, fanfou_cookie, fanfou_token):
|
||||
# update min_id
|
||||
if statuses:
|
||||
min_id = statuses[-1]['id']
|
||||
else:
|
||||
min_id = None
|
||||
|
||||
if __name__ == '__main__':
|
||||
cookie = 'u=stokesia; uuid=24edfe42401cbb03cf1f.1676446846.21; PHPSESSID=d4l9m3tp09gasff6r3u8mv9p12; m=yvettezhong%40gmail.com; tgw_l7_route=f174d6f255742a6ee2e9a07cf9cca0fa'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user