Code Monkey home page Code Monkey logo

onlyfans-dynamic-rules's Introduction

Where are the rules?

https://raw.githubusercontent.com/SneakyOvis/onlyfans-dynamic-rules/main/rules.json

In addition, documentation can be found in the doc directory.

How to generate sign header from rules:

import sha1 from 'js-sha1';

const rules = JSON.parse(`{
    "app-token": "33d57ade8c02dbc5a333db99ff9ae26a",
    "static_param": "n4GYH4LDIHQzGeLh2oxRhjaQdl1yNsg8",
    "prefix": "6471",
    "suffix": "63b430f2",
    "checksum_constant": 544,
    "checksum_indexes": [0,0,0,1,2,2,5,7,8,9,12,12,12,16,19,19,21,22,23,24,24,25,26,27,29,30,31,31,32,33,33,36]
}`);

const path = '/api/path';
const time = Date.now().toString();
const hash = sha1([rules['static_param'], time, path, rules['user-id']].join('\n'));
const checksum = rules['checksum_indexes'].reduce((total, current) => total += hash[current].charCodeAt(0), 0) + rules['checksum_constant'];
const sign = [rules['prefix'], hash, checksum.toString(16), rules['suffix']].join(':');
console.log(sign);

How to make api request:

import sha1 from 'js-sha1';

const rules = JSON.parse(`{
    "app-token": "33d57ade8c02dbc5a333db99ff9ae26a",
    "static_param": "n4GYH4LDIHQzGeLh2oxRhjaQdl1yNsg8",
    "prefix": "6471",
    "suffix": "63b430f2",
    "checksum_constant": 544,
    "checksum_indexes": [0,0,0,1,2,2,5,7,8,9,12,12,12,16,19,19,21,22,23,24,24,25,26,27,29,30,31,31,32,33,33,36]
}`);

function createHeaders(path, rules) {
    const time = Date.now().toString();
    const hash = sha1([rules['static_param'], time, path, rules['user-id']].join('\n'));
    const checksum = rules['checksum_indexes'].reduce((total, current) => total += hash[current].charCodeAt(0), 0) + rules['checksum_constant'];
    const sign = [rules['prefix'], hash, checksum.toString(16), rules['suffix']].join(':');
    return {
        accept: 'application/json, text/plain, */*',
        'app-token': rules['app-token'],
        cookie: rules['cookie'],
        sign: sign,
        time: time,
        'user-id': rules['user-id'],
        'user-agent': rules['user-agent'],
        'x-bc': rules['x-bc']
    };
}

async function callAPI(path, rules) {
    rules = {
        ...rules,
        ...{
            'user-id': 'get from browser',
            'x-bc': 'get from browser',
            'cookie': 'get from browser',
            'user-agent': 'get from browser'
        }
    };

    const headers = createHeaders(path, rules);
    const response = await fetch(
        `https://onlyfans.com${path}`,
        { headers: headers }
    );
    
    return await response.json();
}

const path = '/api2/v2/users/list?r2[]=255449830';
const data = await callAPI(path, rules);
console.log(data);

onlyfans-dynamic-rules's People

Contributors

sneakyovis avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.