npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

jdark-facebook-sdk

v2.0.5

Published

Facebook SDK with proxy support(Cookies)

Readme

JdarkSdk

A powerful Node.js SDK for interacting with Facebook's API, providing easy access to posts, profiles, and reactions.

Features

  • Easy Facebook API integration
  • Load single posts with detailed information
  • Fetch profile feeds with pagination
  • React to posts (Like, Love, etc.)
  • Cookie-based authentication
  • Proxy support
  • Debug mode for development

Installation

npm install jdark-facebook-sdk

Quick Start

const { JdarkSdk } = require('jdark-facebook-sdk');

// Initialize SDK with cookies
const sdk = new JdarkSdk('your_facebook_cookies_string');

// With proxy support
const sdk = new JdarkSdk('your_facebook_cookies_string', 'http://proxy:port');

// Initialize the SDK
const isInitialized = await sdk.initialize();
if (isInitialized) {
    console.log('SDK initialized successfully!');
}

API Reference

Constructor

new JdarkSdk(cookies_str, proxy = null)

Methods

initialize()

Initializes the SDK and validates Facebook tokens.

encode(data, type)

Encodes data for Facebook operations.

// Encode for single post
const encoded = sdk.encode({ postId: 'POST_ID', profileId: 'PROFILE_ID' }, 'singlepost');

// Encode for reactions
const encoded = sdk.encode({ postId: 'POST_ID' }, 'feedback');

postSingle(storyID)

Loads detailed information for a single post.

const postData = await sdk.postSingle('ENCODED_STORY_ID');

postFeedProfile(profileId, cursor = "")

Fetches posts from a profile's feed with pagination support.

// First page
const feed = await sdk.postFeedProfile('PROFILE_ID');

// Next page with cursor
const nextFeed = await sdk.postFeedProfile('PROFILE_ID', 'CURSOR_TOKEN');

reactorPost()

Provides access to post reaction functionality. reactionType : LIKE|LOVE|HAHA|WOW|SAD|ANGRY

const reactor = await sdk.reactorPost();

searchPage(searchPage, cursor = "")

Search for pages and profiles.

const results = await sdk.searchPage('search_term');

Usage Examples

Complete Example

const { JdarkSdk } = require('jdark-facebook-sdk');

(async () => {
    // Initialize SDK
    const sdk = new JdarkSdk('your_facebook_cookies');
    const isReady = await sdk.initialize();
    
    if (!isReady) {
        console.error('Failed to initialize SDK');
        return;
    }
    
    try {
        // Load a single post
        const storyId = sdk.encode({ 
            postId: 'POST_ID', 
            profileId: 'PROFILE_ID' 
        }, 'singlepost');
        
        const post = await sdk.postSingle(storyId);
        console.log('Post data:', post);
        
        // Get profile feed
        const profileFeed = await sdk.postFeedProfile('PROFILE_ID');
        console.log('Profile feed:', profileFeed);
        
        // Search for pages
        const searchResults = await sdk.searchPage('search_term');
        console.log('Search results:', searchResults);
        
    } catch (error) {
        console.error('Error:', error);
    }
})();

Profile Feed Scanning

async function scanProfile(profileId) {
    const sdk = new JdarkSdk('your_cookies');
    await sdk.initialize();
    
    let cursor = '';
    let allPosts = [];
    
    do {
        const feed = await sdk.postFeedProfile(profileId, cursor);
        allPosts.push(...feed.posts);
        cursor = feed.nextCursor;
        
        console.log(`Loaded ${feed.posts.length} posts`);
        
    } while (cursor);
    
    return allPosts;
}

Error Handling

try {
    const sdk = new JdarkSdk('cookies');
    const success = await sdk.initialize();
    
    if (!success) {
        throw new Error('SDK initialization failed');
    }
    
    const post = await sdk.postSingle('story_id');
    
} catch (error) {
    console.error('SDK Error:', error.message);
}

Security Notes

  • Never commit Facebook cookies to version control
  • Use environment variables for sensitive data
  • Respect Facebook's Terms of Service
  • Implement rate limiting to avoid being blocked

Requirements

  • Node.js 12+
  • Valid Facebook session cookies
  • Internet connection

Donation

If this SDK helps you, consider supporting development:

PayPal: [email protected]

License

This project is for educational purposes only. Please respect Facebook's Terms of Service and use responsibly.

Disclaimer

This SDK is not officially associated with Facebook/Meta. Use at your own risk and ensure compliance with Facebook's Terms of Service.