Unified social media management - posting, analytics, and insights
Project description
Socialia
Unified social media management — posting, analytics, and insights
Part of SciTeX for scientific research automation.
Installation
pip install socialia
# Or with optional dependencies
pip install socialia[reddit] # Reddit support
pip install socialia[youtube] # YouTube support
pip install socialia[analytics] # Google Analytics Data API
pip install socialia[all] # Everything
Quick Start
from socialia import Twitter, LinkedIn, Reddit, YouTube, GoogleAnalytics
# Post to Twitter
twitter = Twitter()
twitter.post("Hello World!")
# Post to LinkedIn
linkedin = LinkedIn()
linkedin.post("Professional update!")
# Track analytics
ga = GoogleAnalytics()
ga.track_event("page_view", {"page": "/docs"})
CLI Usage
# Post to Twitter
socialia post twitter "Hello World!"
# Post to LinkedIn
socialia post linkedin "Professional update!"
# Post to Reddit
socialia post reddit "Post body" --subreddit python --title "Post Title"
# Post to YouTube (video upload)
socialia post youtube "Description" --video video.mp4 --title "My Video"
# Analytics tracking
socialia analytics track page_view --param page /docs
# Get realtime users
socialia analytics realtime
# Post from file
socialia post twitter --file tweet.txt
# Delete a post
socialia delete twitter 1234567890
# Post a thread (separate posts with ---)
socialia thread twitter --file thread.txt
# Dry run (preview without posting)
socialia post twitter "Test" --dry-run
# Show all commands
socialia help-recursive
# JSON output
socialia --json post twitter "Hello"
Python API
from socialia import Twitter, LinkedIn, Reddit, YouTube, GoogleAnalytics
# Twitter
twitter = Twitter()
result = twitter.post("Hello World!")
twitter.post_thread(["First", "Second", "Third"])
# LinkedIn
linkedin = LinkedIn()
linkedin.post("Professional update!")
# Reddit (requires: pip install socialia[reddit])
reddit = Reddit()
reddit.post("Post body", subreddit="test", title="Title")
# YouTube (requires: pip install socialia[youtube])
youtube = YouTube()
youtube.post("Description", video_path="video.mp4", title="My Video")
# Google Analytics (requires: pip install socialia[analytics])
ga = GoogleAnalytics()
ga.track_event("social_post", {"platform": "twitter", "post_id": "123"})
ga.get_page_views(start_date="7daysAgo", end_date="today")
MCP Server
Add to Claude Code settings:
{
"mcpServers": {
"socialia": {
"command": "python",
"args": ["-m", "socialia.mcp_server"],
"env": {
"SOCIALIA_X_CONSUMER_KEY": "...",
"SOCIALIA_X_CONSUMER_KEY_SECRET": "...",
"SOCIALIA_X_ACCESSTOKEN": "...",
"SOCIALIA_X_ACCESSTOKEN_SECRET": "..."
}
}
}
}
Environment Variables
# Twitter/X
export SOCIALIA_X_CONSUMER_KEY="your_consumer_key"
export SOCIALIA_X_CONSUMER_KEY_SECRET="your_consumer_secret"
export SOCIALIA_X_ACCESSTOKEN="your_access_token"
export SOCIALIA_X_ACCESSTOKEN_SECRET="your_access_token_secret"
# LinkedIn
export SOCIALIA_LINKEDIN_ACCESS_TOKEN="your_access_token"
# Reddit
export SOCIALIA_REDDIT_CLIENT_ID="your_client_id"
export SOCIALIA_REDDIT_CLIENT_SECRET="your_client_secret"
export SOCIALIA_REDDIT_USERNAME="your_username"
export SOCIALIA_REDDIT_PASSWORD="your_password"
# YouTube
export SOCIALIA_YOUTUBE_CLIENT_SECRETS_FILE="path/to/client_secrets.json"
# Google Analytics
export SOCIALIA_GOOGLE_ANALYTICS_MEASUREMENT_ID="G-XXXXXXXXXX"
export SOCIALIA_GOOGLE_ANALYTICS_API_SECRET="your_api_secret"
export SOCIALIA_GOOGLE_ANALYTICS_PROPERTY_ID="123456789" # Optional, for Data API
Detailed setup guide: socialia setup or see docs/SETUP.md
Supported Platforms
| Platform | Status | API | Install |
|---|---|---|---|
| Twitter/X | Ready | v2 OAuth 1.0a | pip install socialia |
| Ready | v2 OAuth 2.0 | pip install socialia |
|
| Ready | PRAW | pip install socialia[reddit] |
|
| YouTube | Ready | Data API v3 | pip install socialia[youtube] |
| Google Analytics | Ready | GA4 + Data API | pip install socialia[analytics] |
Project Structure
socialia/
├── src/socialia/ # Python package
│ ├── cli/ # CLI with argparse
│ ├── twitter.py # Twitter/X API
│ ├── linkedin.py # LinkedIn API
│ ├── reddit.py # Reddit API (PRAW)
│ ├── youtube.py # YouTube API
│ ├── analytics.py # Google Analytics
│ ├── mcp_server.py # MCP server (delegates to CLI)
│ └── base.py # Base class
├── docs/
│ ├── platforms/ # Platform API documentation
│ └── SETUP.md # Step-by-step setup guide
├── examples/ # Usage examples
├── Makefile # Command dispatcher
├── pyproject.toml
└── .env # Credentials (gitignored)
SciTeX Integration
Socialia is part of the SciTeX ecosystem:
# Install via scitex
pip install scitex[social]
# Use in research workflows
import scitex as stx
from socialia import Twitter
@stx.session
def share_results(twitter=stx.INJECTED):
# Auto-configured from scitex settings
twitter.post("New research results!")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
socialia-0.1.4.tar.gz
(41.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
socialia-0.1.4-py3-none-any.whl
(42.4 kB
view details)
File details
Details for the file
socialia-0.1.4.tar.gz.File metadata
File hashes
2d83b81ea7dc13ba0d0891797d820bc8d3cbc68a55847d69d980166b92fd81be845ca1d8036f7521fb684ad78371452f894f55ac8245e09da936f495e41db10003103cf6d8e804defcd5d6af47010f4dSee more details on using hashes here.