Skip to content

Commit c4df069

Browse files
committed
Write proper readme
1 parent 834d36c commit c4df069

File tree

1 file changed

+163
-14
lines changed

1 file changed

+163
-14
lines changed

README.md

Lines changed: 163 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,180 @@
1-
# speakerdeck-scraper
1+
# speakerdeck-api
22

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

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

8-
`speakerdeck-scraper` also has support for extensions, the extension that currently exists is Location, which
9-
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!
10-
118
## API Usage
129

10+
Install and start the API:
11+
1312
```console
14-
$ go get github.com/luxas/speakerdeck-scraper/cmd/speakerdeck-api
13+
$ go get github.com/luxas/speakerdeck-api/cmd/speakerdeck-api
1514
$ $GOPATH/bin/speakerdeck-api
1615
INFO[0000] Starting Speakerdeck API...
17-
$ curl http://localhost:8080/api/users/luxas
18-
{ ... }
19-
$ curl http://localhost:8080/api/talks/luxas
20-
[ { ... }, { ... }, ... ]
21-
$ curl http://localhost:8080/api/talks/luxas/getting-started-in-the-kubernetes-community
22-
{ ... }
16+
```
17+
18+
Get information about a user:
19+
20+
```shell
21+
curl http://localhost:8080/api/users/luxas
22+
```
23+
24+
```json
25+
{
26+
"author": {
27+
"name": "Lucas Käldström",
28+
"handle": "luxas",
29+
"link": "https://speakerdeck.com/luxas",
30+
"avatarLink": "https://secure.gravatar.com/avatar/111ac0b31c0dc219c84ddadedc8e5f67?s=128"
31+
},
32+
"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.",
33+
"talkPreviews": [
34+
...,
35+
{
36+
"title": "Getting Started in the Kubernetes Community",
37+
"id": "getting-started-in-the-kubernetes-community",
38+
"views": 92,
39+
"stars": 1,
40+
"date": "2019-05-21T00:00:00Z",
41+
"link": "https://speakerdeck.com/luxas/getting-started-in-the-kubernetes-community",
42+
"dataID": "6816e10f104a44cebb0915b392cadd2d"
43+
},
44+
...,
45+
]
46+
}
47+
```
48+
49+
Get detailed information about a user's talks (all of them):
50+
51+
```shell
52+
curl http://localhost:8080/api/talks/luxas
53+
```
54+
55+
```json
56+
[
57+
...,
58+
{
59+
"title": "Getting Started in the Kubernetes Community",
60+
"id": "getting-started-in-the-kubernetes-community",
61+
"views": 92,
62+
"stars": 1,
63+
"date": "2019-05-21T00:00:00Z",
64+
"link": "https://speakerdeck.com/luxas/getting-started-in-the-kubernetes-community",
65+
"dataID": "6816e10f104a44cebb0915b392cadd2d",
66+
"author": {
67+
"name": "Lucas Käldström",
68+
"handle": "luxas",
69+
"link": "https://speakerdeck.com/luxas",
70+
"avatarLink": "https://secure.gravatar.com/avatar/111ac0b31c0dc219c84ddadedc8e5f67?s=47"
71+
},
72+
"category": "Technology",
73+
"categoryLink": "https://speakerdeck.com/c/technology",
74+
"downloadLink": "https://speakerd.s3.amazonaws.com/presentations/6816e10f104a44cebb0915b392cadd2d/Lucas_Kaldstrom-Nikhita_Raghunath_-_May_21_-_Morning.pdf",
75+
"extraLinks": {
76+
"github.com": [
77+
"https://github.com/nikhita"
78+
]
79+
},
80+
"hide": false
81+
},
82+
...,
83+
]
84+
```
85+
86+
Get detailed information about one of the user's talks:
87+
88+
```shell
89+
curl http://localhost:8080/api/talks/luxas/getting-started-in-the-kubernetes-community
90+
```
91+
92+
```json
93+
[
94+
{
95+
"title": "Getting Started in the Kubernetes Community",
96+
"id": "getting-started-in-the-kubernetes-community",
97+
"views": 92,
98+
"stars": 1,
99+
"date": "2019-05-21T00:00:00Z",
100+
"link": "https://speakerdeck.com/luxas/getting-started-in-the-kubernetes-community",
101+
"dataID": "6816e10f104a44cebb0915b392cadd2d",
102+
"author": {
103+
"name": "Lucas Käldström",
104+
"handle": "luxas",
105+
"link": "https://speakerdeck.com/luxas",
106+
"avatarLink": "https://secure.gravatar.com/avatar/111ac0b31c0dc219c84ddadedc8e5f67?s=47"
107+
},
108+
"category": "Technology",
109+
"categoryLink": "https://speakerdeck.com/c/technology",
110+
"downloadLink": "https://speakerd.s3.amazonaws.com/presentations/6816e10f104a44cebb0915b392cadd2d/Lucas_Kaldstrom-Nikhita_Raghunath_-_May_21_-_Morning.pdf",
111+
"extraLinks": {
112+
"github.com": [
113+
"https://github.com/nikhita"
114+
]
115+
},
116+
"hide": false
117+
}
118+
]
119+
```
120+
121+
For reference you can visit [https://speakerdeck.com/luxas/getting-started-in-the-kubernetes-community](https://speakerdeck.com/luxas/getting-started-in-the-kubernetes-community) to check where the data is coming from.
122+
123+
### Geolocation
124+
125+
`speakerdeck-api` also has support for extensions, the extension that currently exists is `LocationExtension` (in `./location`), which
126+
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!
127+
128+
Enable it by giving the Google Maps key to the API:
129+
130+
```shell
131+
$GOPATH/bin/speakerdeck-api -maps-api-key <API_KEY>
132+
```
133+
134+
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:
135+
136+
```shell
137+
curl http://localhost:8080/api/talks/luxas/getting-started-in-the-kubernetes-community
138+
```
139+
140+
```json
141+
[
142+
{
143+
"title": "Getting Started in the Kubernetes Community",
144+
"id": "getting-started-in-the-kubernetes-community",
145+
"views": 92,
146+
"stars": 1,
147+
"date": "2019-05-21T00:00:00Z",
148+
"link": "https://speakerdeck.com/luxas/getting-started-in-the-kubernetes-community",
149+
"dataID": "6816e10f104a44cebb0915b392cadd2d",
150+
"author": {
151+
"name": "Lucas Käldström",
152+
"handle": "luxas",
153+
"link": "https://speakerdeck.com/luxas",
154+
"avatarLink": "https://secure.gravatar.com/avatar/111ac0b31c0dc219c84ddadedc8e5f67?s=47"
155+
},
156+
"category": "Technology",
157+
"categoryLink": "https://speakerdeck.com/c/technology",
158+
"downloadLink": "https://speakerd.s3.amazonaws.com/presentations/6816e10f104a44cebb0915b392cadd2d/Lucas_Kaldstrom-Nikhita_Raghunath_-_May_21_-_Morning.pdf",
159+
"extraLinks": {
160+
"github.com": [
161+
"https://github.com/nikhita"
162+
]
163+
},
164+
"hide": false,
165+
"location": {
166+
"requestedAddress": "Fira Gran Via, Av. Joan Carles I, Barcelona, Spain",
167+
"resolvedAddress": "Av. Joan Carles I, 64, 08908 L'Hospitalet de Llobregat, Barcelona, Spain",
168+
"lat": 41.3546878,
169+
"lng": 2.1277339
170+
}
171+
}
172+
]
23173
```
24174

25175
## Library Usage
26176

27-
Check out the Godoc!
28-
More info here coming soon...
177+
Check out the documentation on [pkg.go.dev](pkg.go.dev/github.com/luxas/speakerdeck-api)!
29178

30179
## License
31180

0 commit comments

Comments
 (0)