[go: up one dir, main page]

gfycatdl

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2020 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Gfycatdl

Gfycatdl downloads gifs from gfycat.com

Gfycatdl is a Go library and command line tool.

Note: gfycat.com does have an api which requires an account and each request to be authenticated. This tool simply scrapes the page and gets a download link.

Installation

$ go get github.com/umahmood/gfycatdl

Usage

Command line:

$ gfycatdl -url https://gfycat.com/violetsmartalleycat-sunset-dusk-nature

$ gfycatdl -help

Download gifs from gfycat.com

Usage:

    -help - Print this message and exit.
    -url  - Gfycat url

Example usage:

     $ gfycatdl -url https://gfycat.com/violetsmartalleycat-sunset-dusk-nature

Library:

package main

import (
    "log"
    "github.com/umahmood/gfycatdl"
)

func main() {
    g, err := gfycatdl.New("https://gfycat.com/violetsmartalleycat-sunset-dusk-nature")
    if err != nil {
        log.Fatalln(err)
    }
    scrapedURL, err := g.ScrapeVideoSource()
    if err != nil {
        log.Fatalln(err)
    }
    err = gfycatdl.DownloadFile(g.ResourceName, scrapedURL)
    if err != nil {
        log.Fatalln(err)
    }
}

Documentation

License

See the LICENSE file for license rights and limitations (MIT).

Documentation

Overview

Package gfycatdl downloads gifs from gfycat given a URL

Usage:

package main

import (
    "log"
    "github.com/umahmood/gfycatdl"
)
func main() {
    g, err := gfycatdl.New("https://gfycat.com/violetsmartalleycat-sunset-dusk-nature")
    if err != nil {
        log.Fatalln(err)
    }
    scrapedURL, err := g.ScrapeVideoSource()
    if err != nil {
        log.Fatalln(err)
    }
    err = gfycatdl.DownloadFile(g.ResourceName, scrapedURL)
    if err != nil {
        log.Fatalln(err)
    }
}

Index

Constants

View Source
const (
	Major = 1
	Minor = 0
	Patch = 0
)

Semantic versioning - http://semver.org/

Variables

View Source
var ErrBadDomain = errors.New("url is not a valid gfycat url")

ErrBadDomain url is not a valid gfycat url i.e. https://gfycat.com/violetsmartalleycat-sunset-dusk-nature

View Source
var ErrBadScrape = errors.New("failed to find gfycat downloadable media")

ErrBadScrape failed to find gfycat downloadable media

Functions

func DownloadFile

func DownloadFile(filepath, url string) error

DownloadFile downloads a file given a url pointing to a resource.

func Version

func Version() string

Version returns library version.

Types

type Gfycatdl

type Gfycatdl struct {
	ResourceName string // Name gyfcat resource name
	// contains filtered or unexported fields
}

Gfycatdl instance

func New

func New(gfycatURL string) (*Gfycatdl, error)

New constructs a Gfycatdl instance

func (*Gfycatdl) ScrapeVideoSource

func (g *Gfycatdl) ScrapeVideoSource() (string, error)

ScrapeVideoSource scrapes <source> tags from a gfycat web page

Directories

Path Synopsis
cmd
gfycatdl command

Jump to

Keyboard shortcuts

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