activitystreams2-spec-scraped

Scrape data from the ActivityStreams 2.0 specs: * https://www.w3.org/TR/activitystreams-core/ * https://www.w3.org/TR/activitystreams-vocabulary/

Usage no npm install needed!

<script type="module">
  import activitystreams2SpecScraped from 'https://cdn.skypack.dev/activitystreams2-spec-scraped';
</script>

README

activitystreams2-spec-scraped

Build Status

Scrape data from the ActivityStreams 2.0 specs:

Why?

  • Test libraries that deal with ActivityStreams2 data, e.g. to make sure the library fully models every vocab term. This was the original motivation: to help test gobengo/activitystreams2
  • generate code for libraries in other languages. go-fed/activity did this because the polymorphic nature of ActivityStreams 2.0 / JSON-LD data makes it hard to model in golang's type system
  • render better documentation for ActivityStreams 2.0. Right now the canonical documentation is in a couple huge html files, but it might be easier to maintain HTML docs (ideally with RDFa metadata) if rendered from less messy data like the JSON this library generates.

Usage

node.js/TypeScript

import { scrapeVocabulary, vocabularySpecUrl } from "activitystreams2-spec-scraped"

(async () => {
  let v

  // This will load from a fixture and *will not* make an http request
  v = await scrapeVocabulary()

  // Provide a URL to fetch the html from there, then parse
  v = await scrapeVocabulary(vocabularySpecUrl)

  console.log(v)
})()

Command Line Interface

  • npx activitystreams2-spec-scraped
  • npm install -g activitystreams2-spec-scraped && activitystreams2-spec-scraped
  • Clone repo and npm install && npm start
$ npx activitystreams2-spec-scraped

The output is big!. See ./data/ for a full example.