Skip to content

Zack-911/ForgeSocial

ForgeSocial

πŸ”— Quick Links


πŸ“– Introduction

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!

✨ Features

  • 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

πŸš€ Installation

npm install github:zack-911/forgesocial#main

βš™οΈ Configuration

Environment Variables

Create 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_token

πŸŽ₯ YouTube

youtube: {
  enabled: true,
  cookie: process.env.YOUTUBE_COOKIE,
  userAgent: process.env.YOUTUBE_UA,
  cache: true,
  log: 'NONE'
}

πŸ”‘ How to Get YouTube Credentials

  1. Open an incognito/private browser window.

  2. Log into YouTube.

  3. Open DevTools (F12) β†’ Network tab.

  4. Reload the page β†’ click any request to youtube.com.

  5. Copy headers:

    • Cookie β†’ paste into .env as YOUTUBE_COOKIE=...
    • User-Agent β†’ paste into .env as YOUTUBE_UA=...
  6. Close the incognito window. πŸ’‘ Refresh your cookie weekly to avoid expired sessions.


πŸ‘½ Reddit

reddit: {
  redditUsername: process.env.REDDIT_USERNAME,
  clientID: process.env.REDDIT_CLIENT_ID,
  clientSecret: process.env.REDDIT_CLIENT_SECRET,
}

πŸ”‘ How to Get Reddit Credentials

  1. Log into Reddit Apps.

  2. Scroll to Developed Applications β†’ click Create App.

  3. Fill in:

    • Name: Your app name (e.g., ForgeSocialTest).
    • Type: Select script.
    • Redirect URI: Enter http://localhost:8080 (not actually used here).
  4. Once created:

    • Client ID = string under app name.
    • Client Secret = shown as β€œsecret”.
  5. Add them to .env:

    REDDIT_CLIENT_ID=your_id
    REDDIT_CLIENT_SECRET=your_secret
    REDDIT_USERNAME=your_username

πŸ™ GitHub

github: {
  token: process.env.GITHUB_TOKEN,
  log: false,
}

πŸ”‘ How to Get GitHub PAT

  1. Log into GitHub.

  2. Go to Settings β†’ Developer settings β†’ Personal access tokens.

  3. Choose Tokens (classic) β†’ Generate new token.

  4. Select scopes:

    • repo:public_repo (read-only public repos).
    • Or full repo if you need issue/comment interactions.
  5. Copy the token (GitHub only shows it once).

  6. Add to .env:

    GITHUB_TOKEN=your_pat_here

⚠️ Rate Limits

YouTube

  • Uses youtubei.js via YouTube’s private API.
  • No fixed official limits, but spamming may get you blocked.
  • Avoid bulk downloads and refresh cookies regularly.

Reddit

  • Unknown

GitHub

  • Authenticated: 5,000 requests/hour

🚦 Usage Example

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);

🀝 Contributing

Contributions are welcome! Please read our Contributing Guidelines.


πŸ“„ License

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.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •