Something went wrong. Try again.
A community based topic aggregation platform built on atproto
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135#!/usr/bin/env python3"""Quick script to post a Streamable video to test-usnews community.Uses the kagi-news CovesClient infrastructure."""
import sysimport os
# Add kagi-news src to path to use CovesClientsys.path.insert(0, os.path.join(os.path.dirname(__file__), '../aggregators/kagi-news'))
from src.coves_client import CovesClient
def main(): # Configuration COVES_API_URL = "http://localhost:8081" PDS_URL = "http://localhost:3001"
# Use PDS instance credentials (from .env.dev) HANDLE = "testuser123.local.coves.dev" PASSWORD = "test-password-123"
# Post details COMMUNITY_HANDLE = "test-usnews.community.coves.social"
# Post 1: Streamable video STREAMABLE_URL = "https://streamable.com/7kpdft" STREAMABLE_TITLE = "NBACentral - \"Your son don't wanna be here, we know it's your last weekend. Enjoy ..."
# Post 2: Reddit highlight REDDIT_URL = "https://www.reddit.com/r/nba/comments/1orfsgm/highlight_giannis_antetokounmpo_41_pts_15_reb_9/" REDDIT_TITLE = "[Highlight] Giannis Antetokounmpo (41 PTS, 15 REB, 9 AST) tallies his 56th career regular season game of 40+ points, passing Kareem Abdul-Jabbar for the most such games in franchise history. Milwaukee defeats Chicago 126-110 to win their NBA Cup opener."
# Initialize client print(f"Initializing Coves client...") print(f" API URL: {COVES_API_URL}") print(f" PDS URL: {PDS_URL}") print(f" Handle: {HANDLE}")
client = CovesClient( api_url=COVES_API_URL, handle=HANDLE, password=PASSWORD, pds_url=PDS_URL )
# Authenticate print("\nAuthenticating...") try: client.authenticate() print(f"✓ Authenticated as {client.did}") except Exception as e: print(f"✗ Authentication failed: {e}") return 1
# Post 1: Streamable video print("\n" + "="*60) print("POST 1: STREAMABLE VIDEO") print("="*60)
print("\nCreating minimal external embed (URI only)...") streamable_embed = { "$type": "social.coves.embed.external", "external": { "uri": STREAMABLE_URL } } print(f"✓ Embed created with URI only (unfurl service should enrich)")
print(f"\nPosting to {COMMUNITY_HANDLE}...") print(f" Title: {STREAMABLE_TITLE}") print(f" Video: {STREAMABLE_URL}")
try: post_uri = client.create_post( community_handle=COMMUNITY_HANDLE, title=STREAMABLE_TITLE, content="", facets=[], embed=streamable_embed )
print(f"\n✓ Streamable post created successfully!") print(f" URI: {post_uri}")
except Exception as e: print(f"\n✗ Streamable post creation failed: {e}") import traceback traceback.print_exc() return 1
# Post 2: Reddit highlight print("\n" + "="*60) print("POST 2: REDDIT HIGHLIGHT") print("="*60)
print("\nCreating minimal external embed (URI only)...") reddit_embed = { "$type": "social.coves.embed.external", "external": { "uri": REDDIT_URL } } print(f"✓ Embed created with URI only (unfurl service should enrich)")
print(f"\nPosting to {COMMUNITY_HANDLE}...") print(f" Title: {REDDIT_TITLE}") print(f" URL: {REDDIT_URL}")
try: post_uri = client.create_post( community_handle=COMMUNITY_HANDLE, title=REDDIT_TITLE, content="", facets=[], embed=reddit_embed )
print(f"\n✓ Reddit post created successfully!") print(f" URI: {post_uri}") print(f"\n" + "="*60) print("Both posts created! Check them out at !test-usnews") print("="*60) return 0
except Exception as e: print(f"\n✗ Reddit post creation failed: {e}") import traceback traceback.print_exc() return 1
if __name__ == "__main__": sys.exit(main())