-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support cross app comments. #19
Comments
brilliant |
Made a little Proof of Concept (PoC) and it works fine. When the Boost comes in it needs to pull the RSS feed and find related item. I did not except the ID of the status on the local server to be different then that on the remote server; It needs to find the local ID via the V2 search API before posting a reply. import asyncio
import atoot
import logging
import requests
from urllib.parse import urlparse
from bs4 import BeautifulSoup
from uuid import uuid4
mastodon_instance='noagendasocial.com'
mastodon_access_token='REDACTED'
feed_url='https://feeds.podcastindex.org/pc20.xml'
episode_title='Episode 134: ChapterGPT'
episode_guid='PC20134'
logging.getLogger().setLevel(logging.DEBUG)
async def main():
logging.info("Start")
mastodon = await atoot.MastodonAPI.create(
mastodon_instance, access_token=mastodon_access_token
)
resp = await mastodon.verify_account_credentials()
logging.debug(resp)
logging.info(f"Connected to {mastodon_instance}")
reply_to_id = None
response = requests.get(feed_url)
if response.status_code in [requests.status_codes.codes.ok]:
soup = BeautifulSoup(response.text, "lxml")
items = soup.find_all(["podcast:liveitem", "item"])
item = next(filter(lambda x: x.title.get_text() == episode_title or x.guid.get_text() == episode_guid, items), None)
if item is not None:
social_interact = item.find("podcast:socialinteract", protocol="activitypub")
if social_interact is not None and social_interact['uri'] is not None:
status = await mastodon.search(social_interact['uri'], resolve=True)
if status is not None and status.get('statuses'):
reply_to_id = status.get('statuses', [{}])[0].get('id')
print(reply_to_id)
resp = await mastodon.create_status(
status=str(uuid4()),
in_reply_to_id=reply_to_id,
)
logging.debug(resp)
await mastodon.close()
logging.info(f"Closed")
asyncio.run(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Big fan. Though of a possible enhancement today while working on PeerTube Boostagram support.
If the item being boosted has podcast:socialinteract configured with the activitypub protocol, The bot could post as a reply to the base post instead of to its own timeline. Thus making the boosts show up in cross-app comments for the episode.
The text was updated successfully, but these errors were encountered: