mirror of
https://github.com/d0zingcat/bluesky-crossposter.git
synced 2026-05-13 23:16:50 +00:00
added handling of posts referencing feeds
This commit is contained in:
15
crosspost.py
15
crosspost.py
@@ -61,10 +61,17 @@ def getPosts():
|
||||
# both tweets that are not replies, and posts that are part of a thread.
|
||||
replyToUser = bsky_handle
|
||||
replyTo = ""
|
||||
# Checking if post is a quote tweet
|
||||
# Checking if post is a quote post. Posts with references to feeds look like quote posts but aren't, and so will fail on missing attribute.
|
||||
# Since quote posts can give values in two different ways it's a bit of a hassle to double check if it is an actual quote post,
|
||||
# so instead I just try to run the function and if it fails I'll set postType as an empty string to signify that this post should
|
||||
# not be crossposted. If there is some reason you would want to crosspost a post referencing a bluesky-feed that I'm not
|
||||
# seeing, I might update this in the future.
|
||||
if feed_view.post.embed and hasattr(feed_view.post.embed, "record"):
|
||||
replyToUser, replyTo = getQuotePost(feed_view.post.embed.record)
|
||||
postType = "quote"
|
||||
try:
|
||||
replyToUser, replyTo = getQuotePost(feed_view.post.embed.record)
|
||||
postType = "quote"
|
||||
except:
|
||||
postType = ""
|
||||
# Checking if post is regular reply
|
||||
elif feed_view.post.record.reply:
|
||||
replyToUser = getReplyToUser(feed_view.post.record.reply)
|
||||
@@ -73,7 +80,7 @@ def getPosts():
|
||||
if not replyToUser:
|
||||
continue
|
||||
# Checking if post is by user (i.e. not a repost), withing the last 12 hours and either not a reply or a reply in a thread.
|
||||
if feed_view.post.author.handle == bsky_handle and timestamp > datetime.now() - timedelta(hours = 12) and replyToUser == bsky_handle:
|
||||
if postType and feed_view.post.author.handle == bsky_handle and timestamp > datetime.now() - timedelta(hours = 12) and replyToUser == bsky_handle:
|
||||
# Fetching images if there are any in the post
|
||||
imageData = ""
|
||||
images = []
|
||||
|
||||
Reference in New Issue
Block a user