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 🙏

© 2024 – Pkg Stats / Ryan Hefner

twspace-crawler

v1.14.1

Published

Script to monitor & download Twitter Spaces 24/7

Downloads

350

Readme

twspace-crawler

npm npm

Node.js script & command-line app to automatically monitor & download Twitter Spaces.

UPDATE 2023-07-01: SINCE TWITTER CHANGED THEIR APIS, READ INSTALLATION FIRST

Contents

  1. Requirements
  2. Env
  3. Docker
  4. Installation
  5. Usage
  6. Options
  7. Commands
  8. Webhooks
  9. Changelog

Requirements

Env

| Name | Desc | - | - | LOG_LEVEL | - | TWITTER_AUTH_TOKEN | - | TWITTER_CSRF_TOKEN | - | SKIP_DOWNLOAD | - | SKIP_DOWNLOAD_AUDIO | - | SKIP_DOWNLOAD_CAPTION | -

Docker

Recommended

Monitor users

  • See example

  • Download docker-compose.yaml & config.yaml

  • Sign in Twitter

  • Open DevTools (F12) > Application > Storage > Cookies

  • Update docker compose environment

    • TWITTER_AUTH_TOKEN: Value of auth_token
    • TWITTER_CSRF_TOKEN: Value of ct0
  • Run

    docker compose up -d

Download Space

docker run --rm \
  -e TWITTER_AUTH_TOKEN=<auth_token> \
  -e TWITTER_CSRF_TOKEN=<csrf_token> \
  -v ./logs:/app/logs \
  -v ./download:/app/download \
  ghcr.io/hitomarukonpaku/twspace-crawler \
  --id 1mnGeRRRwkrJX

Installation

FULL INSTALLATION

Command-line installation

npm install --global twspace-crawler

Module installation

npm install twspace-crawler

Usage

Monitor user(s) indefinitely, wait for live Space and download when Space ended

twspace-crawler --user nakiriayame,LaplusDarknesss
twspace-crawler --env ./.env --config ./config.json

Monitor & download Space by id

twspace-crawler --id 1yoJMWvbybNKQ

Download Space by playlist url

twspace-crawler --url https://prod-fastly-ap-northeast-1.video.pscp.tv/Transcoding/v1/hls/1Nq1QFkYTQ4v1X4BTV_aJ_pFeQhYyuYXY7ykz5xB7v5NvGwFMJMKwnRBmxyi9twF4BZ90ZKks5wdGKqESVsjLw...

Download Space by playlist url with additional metadata (if Space url still available)

twspace-crawler --id 1yoJMWvbybNKQ --url https://prod-fastly-ap-northeast-1.video.pscp.tv/Transcoding/v1/hls/1Nq1QFkYTQ4v1X4BTV_aJ_pFeQhYyuYXY7ykz5xB7v5NvGwFMJMKwnRBmxyi9twF4BZ90ZKks5wdGKqESVsjLw...

Options

General options

  -h, --help                        Display help
  -d, --debug                       Show debug logs

One-time download options

  --id <SPACE_ID>                   Monitor & download live Space with its id
  -surl, --space-url <SPACE_URL>    Monitor & download live Space with its URL
  --force                           Force download Space when using with --id
  --url <PLAYLIST_URL>              Download Space using playlist url

User monitoring options

  --env <ENV_PATH>                  Path to .env file, default to current working
                                    folder (See .env.example)
  --config <CONFIG_PATH>            Path to config file (See config.example.json)
  --user <USER>                     Monitor & download live Spaces from users
                                    indefinitely, separate by comma (,)

Additional options

  --skip-download                   Do not download anything
  --skip-download-audio             Do not download audio
  --skip-download-caption           Do not download caption

  --notification                    Show notification about new live Space
  --force-open                      Force open Space in browser

Commands

Use to manually process audio/captions

List

  • cc
  download|d <SPACE_ID> <ENDPOINT> <TOKEN>  Download Space captions, with
                                            - ENDPOINT: Chat endpoint
                                            - TOKEN: Chat access token

  extract|e <FILE> [STARTED_AT]             Extract Space captions

Example

twspace-crawler cc d 1yoJMWneoZwKQ https://prod-chatman-ancillary-ap-northeast-1.pscp.tv 2Ozpcu2xxqb5wxMdkyodUCygOrbYMLv8rq...
twspace-crawler cc e /download/sample_cc.jsonl
twspace-crawler cc e /download/sample_cc.jsonl 1633612289669

Webhooks

Currently support Discord Webooks

Check config.example.yaml ~~or config.example.json~~ for more detail