forked from ruangrupa/konfluks
Compare commits
6 Commits
77d72745ab
...
c4142145e9
Author | SHA1 | Date | |
---|---|---|---|
c4142145e9
|
|||
b1c9c05b6d | |||
05f7fc7a3f | |||
6c3814dd5b | |||
d9bcb29f85 | |||
db0ce65b89 |
@ -9,7 +9,15 @@ from mastodon import Mastodon
|
|||||||
instance = "https://social.lumbung.space"
|
instance = "https://social.lumbung.space"
|
||||||
email = ""
|
email = ""
|
||||||
password = ""
|
password = ""
|
||||||
hashtags = ["jalansesama"]
|
hashtags = [
|
||||||
|
"documentafifteen",
|
||||||
|
"harvestedbyputra",
|
||||||
|
"jalansesama",
|
||||||
|
"lumbungdotspace",
|
||||||
|
"majelisakakbar",
|
||||||
|
"majelisakbar",
|
||||||
|
"warungkopi",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def login_mastodon_bot():
|
def login_mastodon_bot():
|
||||||
@ -95,6 +103,10 @@ def main():
|
|||||||
if not os.path.exists(output_dir):
|
if not os.path.exists(output_dir):
|
||||||
os.mkdir(output_dir)
|
os.mkdir(output_dir)
|
||||||
|
|
||||||
|
all_existing_posts = []
|
||||||
|
for i in os.listdir(output_dir):
|
||||||
|
all_existing_posts += os.listdir(os.path.join(output_dir, i))
|
||||||
|
|
||||||
for hashtag in hashtags:
|
for hashtag in hashtags:
|
||||||
|
|
||||||
hashtag_dir = os.path.join(output_dir, hashtag)
|
hashtag_dir = os.path.join(output_dir, hashtag)
|
||||||
@ -114,12 +126,13 @@ def main():
|
|||||||
post_dir = os.path.join(hashtag_dir, str(post_metadata["id"]))
|
post_dir = os.path.join(hashtag_dir, str(post_metadata["id"]))
|
||||||
|
|
||||||
# if there is a post in the feed we dont already have locally, make it
|
# if there is a post in the feed we dont already have locally, make it
|
||||||
if str(post_metadata["id"]) not in existing_posts:
|
if str(post_metadata["id"]) not in all_existing_posts:
|
||||||
|
|
||||||
if not post_metadata[
|
if not post_metadata[
|
||||||
"local_only"
|
"local_only"
|
||||||
]: # if you get an error here then you are using vanilla Mastodon, this is a Hometown or Glitch only feature
|
]: # if you get an error here then you are using vanilla Mastodon, this is a Hometown or Glitch only feature
|
||||||
create_post(post_dir, post_metadata)
|
create_post(post_dir, post_metadata)
|
||||||
|
all_existing_posts.append(post_metadata["id"])
|
||||||
else:
|
else:
|
||||||
print("not pulling post %s (post is local only)" % (post_metadata["id"]))
|
print("not pulling post %s (post is local only)" % (post_metadata["id"]))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user