···
1
+
#!/usr/bin/env python3
3
+
Quick script to post a Streamable video to test-usnews community.
4
+
Uses the kagi-news CovesClient infrastructure.
10
+
# Add kagi-news src to path to use CovesClient
11
+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../aggregators/kagi-news'))
13
+
from src.coves_client import CovesClient
17
+
COVES_API_URL = "http://localhost:8081"
18
+
PDS_URL = "http://localhost:3001"
20
+
# Use PDS instance credentials (from .env.dev)
21
+
HANDLE = "testuser123.local.coves.dev"
22
+
PASSWORD = "test-password-123"
25
+
COMMUNITY_HANDLE = "test-usnews.community.coves.social"
27
+
# Post 1: Streamable video
28
+
STREAMABLE_URL = "https://streamable.com/7kpdft"
29
+
STREAMABLE_TITLE = "NBACentral - \"Your son don't wanna be here, we know it's your last weekend. Enjoy ..."
31
+
# Post 2: Reddit highlight
32
+
REDDIT_URL = "https://www.reddit.com/r/nba/comments/1orfsgm/highlight_giannis_antetokounmpo_41_pts_15_reb_9/"
33
+
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."
36
+
print(f"Initializing Coves client...")
37
+
print(f" API URL: {COVES_API_URL}")
38
+
print(f" PDS URL: {PDS_URL}")
39
+
print(f" Handle: {HANDLE}")
41
+
client = CovesClient(
42
+
api_url=COVES_API_URL,
49
+
print("\nAuthenticating...")
51
+
client.authenticate()
52
+
print(f"✓ Authenticated as {client.did}")
53
+
except Exception as e:
54
+
print(f"✗ Authentication failed: {e}")
57
+
# Post 1: Streamable video
58
+
print("\n" + "="*60)
59
+
print("POST 1: STREAMABLE VIDEO")
62
+
print("\nCreating minimal external embed (URI only)...")
63
+
streamable_embed = {
64
+
"$type": "social.coves.embed.external",
66
+
"uri": STREAMABLE_URL
69
+
print(f"✓ Embed created with URI only (unfurl service should enrich)")
71
+
print(f"\nPosting to {COMMUNITY_HANDLE}...")
72
+
print(f" Title: {STREAMABLE_TITLE}")
73
+
print(f" Video: {STREAMABLE_URL}")
76
+
post_uri = client.create_post(
77
+
community_handle=COMMUNITY_HANDLE,
78
+
title=STREAMABLE_TITLE,
81
+
embed=streamable_embed
84
+
print(f"\n✓ Streamable post created successfully!")
85
+
print(f" URI: {post_uri}")
87
+
except Exception as e:
88
+
print(f"\n✗ Streamable post creation failed: {e}")
90
+
traceback.print_exc()
93
+
# Post 2: Reddit highlight
94
+
print("\n" + "="*60)
95
+
print("POST 2: REDDIT HIGHLIGHT")
98
+
print("\nCreating minimal external embed (URI only)...")
100
+
"$type": "social.coves.embed.external",
105
+
print(f"✓ Embed created with URI only (unfurl service should enrich)")
107
+
print(f"\nPosting to {COMMUNITY_HANDLE}...")
108
+
print(f" Title: {REDDIT_TITLE}")
109
+
print(f" URL: {REDDIT_URL}")
112
+
post_uri = client.create_post(
113
+
community_handle=COMMUNITY_HANDLE,
114
+
title=REDDIT_TITLE,
120
+
print(f"\n✓ Reddit post created successfully!")
121
+
print(f" URI: {post_uri}")
122
+
print(f"\n" + "="*60)
123
+
print("Both posts created! Check them out at !test-usnews")
127
+
except Exception as e:
128
+
print(f"\n✗ Reddit post creation failed: {e}")
130
+
traceback.print_exc()
133
+
if __name__ == "__main__":