Categorygithub.com/luxas/speakerdeck-api
modulepackage
0.1.1
Repository: https://github.com/luxas/speakerdeck-api.git
Documentation: pkg.go.dev

# README

speakerdeck-api

A scraper implementation for SpeakerDeck, as a workaround due to the lack of an official API.

You can either use this as a library (import speakerdeck "github.com/luxas/speakerdeck-api") or the ready-made (very lightweight) API implementation under cmd/speakerdeck-api.

API Usage

Install and start the API:

$ go get github.com/luxas/speakerdeck-api/cmd/speakerdeck-api
$ $GOPATH/bin/speakerdeck-api
INFO[0000] Starting Speakerdeck API...

Get information about a user:

curl http://localhost:8080/api/users/luxas
{
  "author": {
    "name": "Lucas Käldström",
    "handle": "luxas",
    "link": "https://speakerdeck.com/luxas",
    "avatarLink": "https://secure.gravatar.com/avatar/111ac0b31c0dc219c84ddadedc8e5f67?s=128"
  },
  "abstract": "Lucas is a cloud native enthusiast who has been serving the Kubernetes \u0026 CNCF communities in lead positions for more than 4 years. Lucas is a CNCF Ambassador, running 3 meetup groups in Finland and coordinating the Cloud Native Nordics meetups. He got the \"Top Cloud Native Ambassador\" award together with Sarah Novotny 2017. Lucas has e.g. shepherded kubeadm from inception to GA as a co-lead for SIG Cluster Lifecycle, ported Kubernetes to Raspberry Pi and multiple other platforms. Lucas is a CKA, runs a consulting company \"luxas labs\" for cloud native tech and has spoken at six KubeCons.",
  "talkPreviews": [
    ...,
    {
      "title": "Getting Started in the Kubernetes Community",
      "id": "getting-started-in-the-kubernetes-community",
      "views": 92,
      "stars": 1,
      "date": "2019-05-21T00:00:00Z",
      "link": "https://speakerdeck.com/luxas/getting-started-in-the-kubernetes-community",
      "dataID": "6816e10f104a44cebb0915b392cadd2d"
    },
    ...,
  ]
}

Get detailed information about a user's talks (all of them):

curl http://localhost:8080/api/talks/luxas
[
  ...,
  {
    "title": "Getting Started in the Kubernetes Community",
    "id": "getting-started-in-the-kubernetes-community",
    "views": 92,
    "stars": 1,
    "date": "2019-05-21T00:00:00Z",
    "link": "https://speakerdeck.com/luxas/getting-started-in-the-kubernetes-community",
    "dataID": "6816e10f104a44cebb0915b392cadd2d",
    "author": {
      "name": "Lucas Käldström",
      "handle": "luxas",
      "link": "https://speakerdeck.com/luxas",
      "avatarLink": "https://secure.gravatar.com/avatar/111ac0b31c0dc219c84ddadedc8e5f67?s=47"
    },
    "category": "Technology",
    "categoryLink": "https://speakerdeck.com/c/technology",
    "downloadLink": "https://speakerd.s3.amazonaws.com/presentations/6816e10f104a44cebb0915b392cadd2d/Lucas_Kaldstrom-Nikhita_Raghunath_-_May_21_-_Morning.pdf",
    "extraLinks": {
      "github.com": [
        "https://github.com/nikhita"
      ]
    },
    "hide": false
  },
  ...,
]

Get detailed information about one of the user's talks:

curl http://localhost:8080/api/talks/luxas/getting-started-in-the-kubernetes-community
[
  {
    "title": "Getting Started in the Kubernetes Community",
    "id": "getting-started-in-the-kubernetes-community",
    "views": 92,
    "stars": 1,
    "date": "2019-05-21T00:00:00Z",
    "link": "https://speakerdeck.com/luxas/getting-started-in-the-kubernetes-community",
    "dataID": "6816e10f104a44cebb0915b392cadd2d",
    "author": {
      "name": "Lucas Käldström",
      "handle": "luxas",
      "link": "https://speakerdeck.com/luxas",
      "avatarLink": "https://secure.gravatar.com/avatar/111ac0b31c0dc219c84ddadedc8e5f67?s=47"
    },
    "category": "Technology",
    "categoryLink": "https://speakerdeck.com/c/technology",
    "downloadLink": "https://speakerd.s3.amazonaws.com/presentations/6816e10f104a44cebb0915b392cadd2d/Lucas_Kaldstrom-Nikhita_Raghunath_-_May_21_-_Morning.pdf",
    "extraLinks": {
      "github.com": [
        "https://github.com/nikhita"
      ]
    },
    "hide": false
  }
]

For reference you can visit https://speakerdeck.com/luxas/getting-started-in-the-kubernetes-community to check where the data is coming from.

Geolocation

speakerdeck-api also has support for extensions, the extension that currently exists is LocationExtension (in ./location), which can using a Google Maps API key (with access to the Geocoding API) geolocate your talks just by you putting Location: <address> in the Speakerdeck talk description!

Enable it by giving the Google Maps key to the API:

$GOPATH/bin/speakerdeck-api -maps-api-key <API_KEY>

Now, notice the location field which is generated based on the Location: Fira Gran Via, Av. Joan Carles I, Barcelona, Spain string embedded in the talk description:

curl http://localhost:8080/api/talks/luxas/getting-started-in-the-kubernetes-community
[
  {
    "title": "Getting Started in the Kubernetes Community",
    "id": "getting-started-in-the-kubernetes-community",
    "views": 92,
    "stars": 1,
    "date": "2019-05-21T00:00:00Z",
    "link": "https://speakerdeck.com/luxas/getting-started-in-the-kubernetes-community",
    "dataID": "6816e10f104a44cebb0915b392cadd2d",
    "author": {
      "name": "Lucas Käldström",
      "handle": "luxas",
      "link": "https://speakerdeck.com/luxas",
      "avatarLink": "https://secure.gravatar.com/avatar/111ac0b31c0dc219c84ddadedc8e5f67?s=47"
    },
    "category": "Technology",
    "categoryLink": "https://speakerdeck.com/c/technology",
    "downloadLink": "https://speakerd.s3.amazonaws.com/presentations/6816e10f104a44cebb0915b392cadd2d/Lucas_Kaldstrom-Nikhita_Raghunath_-_May_21_-_Morning.pdf",
    "extraLinks": {
      "github.com": [
        "https://github.com/nikhita"
      ]
    },
    "hide": false,
    "location": {
      "requestedAddress": "Fira Gran Via, Av. Joan Carles I, Barcelona, Spain",
      "resolvedAddress": "Av. Joan Carles I, 64, 08908 L'Hospitalet de Llobregat, Barcelona, Spain",
      "lat": 41.3546878,
      "lng": 2.1277339
    }
  }
]

Library Usage

Check out the documentation on Godoc or pkg.go.dev!

License

MIT

# Packages

No description provided by the author
No description provided by the author
The scraper package contains generic, high-level scraper functionality built on top of github.com/gocolly/colly In order to use it, create a struct (e.g.

# Functions

NewTalk returns a new, empty talk object.
NewUser creates a new User object.
ScrapeTalks returns either one sepecific talk if both userHandle and talkID are set, or a set of all the users' talks in detail if only userHandle is set.
ScrapeUser returns an user object based on the given user handle.

# Structs

Author describes the SD profile of the person that's created the presentations.
Location describes a geographical location for the talk This struct is populated by the LocationExtension, and is set based on a "Location: <address>" string in the talk description.
Talk describes a presentation on Speakerdeck.
TalkPreview contains the information about a talk that can be seen on the user page.
TalkScraper implements scraper.Scraper.
User represents a user on as browsed on the user page (i.e.
UserScraper implements scraper.Scraper.

# Type aliases

Talks orders the Talk objects by time.