speakerdeck

package module
v0.0.0-...-0fbe3c3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2016 License: MIT Imports: 8 Imported by: 0

README

speakerdeck

🚢 Fetch info and Download Slide from Speaker Deck for Go.

Unofficial and Implemented by dirty scraping...

Install

$ go get github.com/moqada/speakerdeck

Usage

import (
	"fmt"
	"io/ioutil"

	"github.com/moqada/speakerdeck"
)

// Fetch Slide
slide, _ := speakerdeck.GetSlide("https://speakerdeck.com/achiku/pycon-jp-2014-python-plus-hive-on-aws-emrdepin-zhe-falseroguji-ji")
fmt.Println(slide.Title, slide.User.username, slide.Category.Name)
// PyCon JP 2014 Python + Hive on AWS EMRで貧者のログ集計 achiku Technology

// Download pdf file as byte[]
pdf, _ := slide.DownloadPDF()

// Save pdf file to current directory
ioutil.WriteFile("./" + slide.Slug + ".pdf", pdf, 0644)

The documentation is on GoDoc

CLI

Documentation

Overview

Package speakerdeck is Fetch info and Download Slide from Speaker Deck for Go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	Name string `json:"name"`
	Slug string `json:"slug"`
	URL  string `json:"url"`
}

Category is speakerdeck category info

func NewCategory

func NewCategory(name, slug string) Category

NewCategory is initialize category

type Slide

type Slide struct {
	Slug        string    `json:"slug"`
	Title       string    `json:"title"`
	Description string    `json:"description"`
	DownloadURL string    `json:"downloadUrl"`
	User        User      `json:"user"`
	Stars       int       `json:"stars"`
	Category    Category  `json:"category"`
	Published   time.Time `json:"published"`
	URL         string    `json:"url"`
}

Slide is speakerdeck slide info

func GetSlide

func GetSlide(url string) (*Slide, error)

GetSlide returns slide info from Speakerdeck slide page

func (*Slide) DownloadPDF

func (s *Slide) DownloadPDF() ([]byte, error)

DownloadPDF downloads PDF of target slide

type User

type User struct {
	Username    string `json:"username"`
	DisplayName string `json:"displayName"`
	URL         string `json:"url"`
}

User is spearkerdeck user info

func NewUser

func NewUser(username, displayName string) User

NewUser is initialize user

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL