Speakerdeck.com scraper for Node.js
npm install speakerdeck-scraperWhy a Scraper? They don't have an API (yet).
Install the module with: npm install --save speakerdeck-scraper
getUser() method accepts a user ID (the speaker deck path) and an optional page number.This returns a Promise resolving to the users information and talks for the supplied page.
`` js
var speakerdeck = require('speakerdeck-scraper');
speakerdeck.getUser('patrickhamann', 2).then(function(user) {
console.log(user.talks.items); // Array containing talk data
});
`
method accepts a talk ID (the speakerdeck.com path) and returns a Promise resolving to the talk information.`js
var speakerdeck = require('speakerdeck-scraper');speakerdeck.getTalk("patrickhamann/building-theguardian-dot-com").then(function(talk){
console.log(talk.title);
})
`$3
The following properties are available on the returned
user object:`javascript
{
"user": {
"id": String,
"url": String,
"name": String,
"avatar": String,
"bio": String
},
"talks": {
"pages": Number,
"page": Number,
"items": [
{
"id": String,
"title": String,
"url": String,
"date": String,
"slides": Number,
"thumbnail": String
}
]
}
}
`$3
The following properties are available on the returned
talk object:`javascript
{
"user": {
"id": String,
"url": String,
"name": String,
"avatar": String
},
"description": String.
"date": String,
"stars": Number,
"category": String,
"views": Number,
"embed": String,
"download": String
}
`Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.Lint your code with
gulp lint and run tests with gulp test`All code is linted and tested automatically once pushed using Travis CI.