GithubHelp home page GithubHelp logo

mohammad-rj / clubhouse Goto Github PK

View Code? Open in Web Editor NEW

This project forked from transitive-bullshit/clubhouse

0.0 0.0 0.0 203 KB

Clubhouse API client and social graph crawler for TypeScript.

License: MIT License

Shell 0.32% TypeScript 99.68%

clubhouse's Introduction

Clubhouse API

Clubhouse API client and social graph crawler for TypeScript.

NPM Build Status Prettier Code Formatting

Features

  • TypeScript - Simple, clean TS/JS wrapper for the Clubhouse API.
  • Rate Limits - Built-in throttling for Clubhouse rate limits.
  • Robust - Built-in retry logic with exponential falloff via got.
  • Crawler - Comes with a built-in crawler for the Clubhouse social graph.
  • ️️Persistent - Crawler comes with optional neo4j support.

Packages

Package NPM Description
clubhouse-client NPM Clubhouse API client
clubhouse-crawler NPM Clubhouse social graph crawler + neo4j support

Install

npm install --save clubhouse-client
# or
yarn add clubhouse-client

Usage

import { ClubhouseClient } from 'clubhouse-client'

const exampleUserId = '2481724'
const examplePhoneNumber = '+15555555555'
const exampleVerificationCode = '5555'

const clubhouse = new ClubhouseClient()

await clubhouse.startPhoneNumberAuth(examplePhoneNumber)

// NOTE: manually get the SMS verification code

await clubhouse.completePhoneNumberAuth(
  examplePhoneNumber,
  exampleVerificationCode
)

// you should now be authenticated with a userId and authToken
// you can alternatively auth directly via the ClubhouseClient constructor

const me = await clubhouse.getMe()

const profile = await clubhouse.getProfile(exampleUserId)

// get a single page of users that our example user is following
const following = await clubhouse.getFollowing(exampleUserId)

// get a single page of users who are following our example user
const followers = await clubhouse.getFollowers(exampleUserId)

// get all of the users that our example user is following
// (this will attempt to fetch all of the page results)
const allFollowing = await clubhouse.getAllFollowing(exampleUserId)

// get all of the users following our example user
// (this will attempt to fetch all of the page results)
const allFollowers = await clubhouse.getAllFollowers(exampleUserId)

See login.js for a basic Node.js example that logs you in using the Clubhouse API and gives you the environment variables that you'll need (put them in .env) to run the other examples.

See example.js for a basic Node.js example that uses a previously authenticated user.

See crawler.js for a more advanced Node.js app that will crawl the Clubhouse social graph.

Rate Limits

By default, the ClubhouseClient is set to make a maximum of one API call per 3.5 seconds, which empirically gets past most Clubhouse rate limits.

You'll definitely still run into some, and it's up to you how to best handle them. PLEASE DO NOT SPAM THE CLUBHOUSE API.

You can customize the default ClubhouseClient throttling via the throttle parameter which uses p-throttle under the hood.

Related

  • clubhouse-py - Clubhouse API written in Python.
  • Houseclub - A barebones unofficial Android app for Clubhouse.
  • hipster.house - An intentionally terrible third-party Clubhouse client for web browsers.

Disclaimer

This code is intended purely for educational purposes. It may go against the Clubhouse ToS, so use at your own discretion. We recommend against using this API / crawler with your personal Clubhouse account — you may get banned.

Happy Hacking 🙃

License

MIT © Travis Fischer, Tim Saval and Ahmed Tokyo

Support my OSS work by following me on twitter twitter

clubhouse's People

Contributors

a-tokyo avatar ahmetozalp avatar transitive-bullshit 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.