Skip to content

Clubhouse API client and social graph crawler for TypeScript.

License

Notifications You must be signed in to change notification settings

transitive-bullshit/clubhouse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c97d2b7 ยท Jan 3, 2023
Mar 26, 2021
Apr 27, 2021
Jun 10, 2021
Mar 21, 2021
Mar 26, 2021
Apr 22, 2021
Mar 21, 2021
Mar 21, 2021
Apr 22, 2021
Apr 27, 2021
Jan 3, 2023
Mar 29, 2021
Apr 22, 2021
Mar 29, 2021
Mar 29, 2021
Apr 22, 2021

Repository files navigation

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