- π Quick Links
- π Introduction
- β¨ Features
- π Installation
- βοΈ Configuration
β οΈ Rate Limits- π¦ Usage Example
- π€ Contributing
- π License
ForgeSocial is a powerful Node.js library that simplifies interaction with various social media platforms through a unified interface. It handles the complex authentication, rate limiting, and API interactions, allowing developers to focus on building amazing social features without worrying about the underlying complexities.
With ForgeSocial, you can:
- Monitor subreddits for new posts
- Track YouTube channels for new uploads
- Interact with GitHub repositories
- And more coming soon!
- Unified API: Single interface for multiple social platforms
- Event-Driven: Real-time event handling for new content
- Easy Configuration: Simple setup with comprehensive options
- Rate Limit Handling: Built-in rate limit management
- Caching: Optional caching to reduce API calls
npm install github:zack-911/forgesocial#mainCreate a .env file in your project root:
# Reddit
REDDIT_USERNAME=your_reddit_username
REDDIT_CLIENT_ID=your_reddit_client_id
REDDIT_CLIENT_SECRET=your_reddit_client_secret
# YouTube
YOUTUBE_COOKIE=your_youtube_cookie
YOUTUBE_UA=your_user_agent
# GitHub
GITHUB_TOKEN=your_github_tokenyoutube: {
enabled: true,
cookie: process.env.YOUTUBE_COOKIE,
userAgent: process.env.YOUTUBE_UA,
cache: true,
log: 'NONE'
}-
Open an incognito/private browser window.
-
Log into YouTube.
-
Open DevTools (F12) β Network tab.
-
Reload the page β click any request to
youtube.com. -
Copy headers:
Cookieβ paste into.envasYOUTUBE_COOKIE=...User-Agentβ paste into.envasYOUTUBE_UA=...
-
Close the incognito window. π‘ Refresh your cookie weekly to avoid expired sessions.
reddit: {
redditUsername: process.env.REDDIT_USERNAME,
clientID: process.env.REDDIT_CLIENT_ID,
clientSecret: process.env.REDDIT_CLIENT_SECRET,
}-
Log into Reddit Apps.
-
Scroll to Developed Applications β click Create App.
-
Fill in:
- Name: Your app name (e.g., ForgeSocialTest).
- Type: Select script.
- Redirect URI: Enter
http://localhost:8080(not actually used here).
-
Once created:
- Client ID = string under app name.
- Client Secret = shown as βsecretβ.
-
Add them to
.env:REDDIT_CLIENT_ID=your_id REDDIT_CLIENT_SECRET=your_secret REDDIT_USERNAME=your_username
github: {
token: process.env.GITHUB_TOKEN,
log: false,
}-
Log into GitHub.
-
Go to Settings β Developer settings β Personal access tokens.
-
Choose Tokens (classic) β Generate new token.
-
Select scopes:
repo:public_repo(read-only public repos).- Or full
repoif you need issue/comment interactions.
-
Copy the token (GitHub only shows it once).
-
Add to
.env:GITHUB_TOKEN=your_pat_here
- Uses
youtubei.jsvia YouTubeβs private API. - No fixed official limits, but spamming may get you blocked.
- Avoid bulk downloads and refresh cookies regularly.
- Unknown
- Authenticated: 5,000 requests/hour
import { ForgeClient } from '@tryforge/forgescript';
import { ForgeSocial } from 'forgesocial';
import dotenv from 'dotenv';
dotenv.config();
const social = new ForgeSocial({
events: ['newRedditPost', 'newYoutubeVideo'],
youtube: {
enabled: true,
cookie: process.env.YOUTUBE_COOKIE,
userAgent: process.env.YOUTUBE_UA,
cache: true,
log: 'NONE',
},
reddit: {
redditUsername: process.env.REDDIT_USERNAME,
clientID: process.env.REDDIT_CLIENT_ID,
clientSecret: process.env.REDDIT_CLIENT_SECRET,
userAgent: 'YourApp/1.0.0',
retryLimit: 3,
requestDelay: 1000,
},
github: {
token: process.env.GITHUB_TOKEN,
log: false,
cache: true,
cacheTTL: 3600,
},
});
const client = new ForgeClient({
extensions: [social],
events: ['ready', 'messageCreate'],
intents: ['Guilds', 'GuildMessages', 'MessageContent'],
prefixes: ['.'],
});
client.login(process.env.DISCORD_TOKEN);Contributions are welcome! Please read our Contributing Guidelines.
This project is licensed under the GPL-3 License β see LICENSE.
Note: ForgeSocial will only support platforms like OnlyFans or Pornhub if Nicky, Aggy, or Berk asks for them uwu.