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

gspan

v0.0.2

Published

Transcribe and annotate C-Span closed captions in Google.

Downloads

2

Readme

POLITICO

GSpan.js

Transcribe and annotate C-Span closed captions in Google.

Why This?

Providing necessary context and checking the facts when politicians and other public figures speak is a critical part of our journalism at POLITICO. Doing them live comes with some hard technical challenges, especially when that context requires many fact-checkers and when we want to show our work alongside the original source.

This library aims to make that process easier by leveraging a platform that is already very good at solving the hard problems involved: Google docs. Using GSpan you’ll have an end-to-end system for acquiring transcripts of a live event, creating a collaborative editing environment in Google docs for fact-checkers to annotate that transcript and, finally, structuring all that data in a way it can be easily consumed by a front-end application or site.

How It Works

GSpan comes with two main features that are designed to work together: transcription and downloading/parsing.

It uses Opened Captions created by Dan Schultz as the source of the transcription. You can read more about the Opened Captions project on Source. These captions are written into a Google Doc using a special markup to signify things like speaker changes and soundbites. Then, reporters can use the native commenting functionality to annotate documents.

Once annotations are done you can convert that Google Doc (with all its annotations) into structured data using GSpan's download functionality. All the unique markup will be turned into an easy-to-use JSON format with rich text elements rendered as Markdown.

What you do with that data and how your page looks is up to you, but here's what we did.

Quick Start

Install the package globally to use the CLI

$ npm install -g gspan

Create a Google Doc. Share it with your Google service account's client email (see Authenticating). Get the Doc ID for that document. You can find it in the URL between d/ and /edit like this:

docId

With an ID in hand you can begin transcribing and downloading with the CLI.

Transcribing from C-Span into a Google Doc
gspan transcribe <doc>

Begins transcribing CSPAN into a document.

Positionals:
  doc  The Google Doc ID                                     [string] [required]

Options:
  --verbose, -v     Log new entries in the console                     [boolean]
  --backfill, -b    Start from a saved backup file                     [boolean]
  --backupFile, -f  A filepath to save a backup                         [string]
Downloading and parsing data from a Google Doc
gspan download <doc> [output]

Downloads a GSpan doc as a JSON file.

Positionals:
  doc     The Google Doc ID                                  [string] [required]
  output  The directory to save the file to                             [string]

Options:
  --authorAPI, -a           A link to an authors API                    [string]
  --authorNameAccessor, -n  Accessor for Google display name            [string]
  --authorIdAccessor, -i    Accessor for unique ID                      [string]
  --defaultPublish, -p      Default for annoation published state      [boolean]

* Boolean arguments can be set to false by setting them equal to false or by adding the no- prefix to their name. (e.g. gspan transcribe DOC_ID --no-verbose or gspan download DOC_ID -p=false)

Authenticating

In order to use this app you'll need a Google Service Account which has write access to your Google Doc. For help with creating a Google Service Account, see Making A Google Service Account.

Once you have your credentials file, you'll need the client_email and private_key. You'll need to make sure that these are saved as environment variables in your runtime under the keys of GAPI_CLIENT_EMAIL and GAPI_PRIVATE_KEY respectively.

There's a number of ways to do this depending on your workflow. If you've never worked with environment variables in node check out this guide.

Finally, also make sure to share the Google Doc you're using with the client_email. It may look long and not like a valid email, but Google will allow it.

Demo

Our inaugural use of GSpan was for the 2019 State of the Union. Check out the page!

API Documentation

Guides

For Users

For Developers