mirror of
https://github.com/Horhik/Instagram2Fedi.git
synced 2024-09-20 21:17:50 +00:00
15 lines
405 B
Python
15 lines
405 B
Python
import hashlib
|
|
def already_posted(id, path):
|
|
with open(path) as file:
|
|
content = file.read().split("\n")
|
|
sha1 = hashlib.sha1(bytes(id, "utf-8")).hexdigest()
|
|
if sha1 in content:
|
|
return True
|
|
return False
|
|
|
|
def mark_as_posted(id, path):
|
|
with open(path, 'a') as file:
|
|
sha1 = hashlib.sha1(bytes(id, "utf-8")).hexdigest()
|
|
file.write(sha1+'\n')
|
|
|