megashares

package module
v0.0.0-...-9b4542c Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2015 License: GPL-2.0 Imports: 8 Imported by: 0

README

#Megashares in Go GoDocgithalytics.com alpha

Megashares API written in Go.

##Installation:

go get github.com/norcalli/megashares

##Example:

###Shitty client: There is a shitty example (aptly named shittyclient.go) in the repository. It should serve as a starting point for figuring out how to use the API. Usage:

This will print the results of the query:

shittyclient -u "username" -p "password" -q "Firefly s01e01"

This will download result n of the query:

shittyclient -u "username" -p "password" -q "Firefly s01e01" -n 0

###Snippet:

Here is a snippet that outlines basic usage.

m := megashares.New()
if err := m.Login(username, password); err != nil {
  log.Fatal("Couldn't login!")
}
entries, _ := m.SearchEntries(query)
for i, entry := range entries {
  fmt.Printf("%d: %s\n", i, entry.Filename)
}
entry := entries[0] // Choose first entry.
fmt.Println(entry.Filename, ":", entry.Url)

##Todo:

  • Add multiple page search support.
  • Clean up filenames better, they sometimes are malformed.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Url      string
	Filename string
}

func ParseEntryFromURL

func ParseEntryFromURL(url string) (*Entry, error)

func (*Entry) String

func (m *Entry) String() string

type Megashares

type Megashares struct {
	CookieJar *cookiejar.Jar
	Client    *http.Client
}

func New

func New() *Megashares

func (*Megashares) Login

func (m *Megashares) Login(username, password string) error

func (*Megashares) Search

func (m *Megashares) Search(query string) ([]byte, error)

func (*Megashares) SearchEntries

func (m *Megashares) SearchEntries(query string) ([]*Entry, error)

func (*Megashares) SearchResponse

func (m *Megashares) SearchResponse(query string) (*http.Response, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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