flickr_downloader

package module
v0.0.0-...-20d3687 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: MIT Imports: 15 Imported by: 0

README

Flickr Downloader

This CLI downloads content from Flickr, writes attribution EXIF data, and can be accessed through the command line or through Go.

Functionality

  1. You can request to download multiple photos that match your query, and the CLI will download them in parallel.
  2. Attribution information (License, Authorship, Link to original) are written into the EXIF metadata of the results.
  3. Doesn't return any two results from the same creator, avoiding duplicates and near-dupes.
  4. Searches by license, preferring the most lenient Creative Commons licenses.
  5. Results are stored as JPEGs, with standard EXIF metadata.

Usage

You'll first need to request a Flickr API key (it's easy!).

Then, place this value in the const declaration in the file called API_KEY (you'll get a warning if you forget). Then it's just:

go build; ./flickr_downloader --query="Trash Panda" --output="NewDirForOutput" --number_of_images=10

for flag documentation, run

./flickr_downloader --help

Support

This is not a project I actively support. It was written for a series of side projects and is unlikely to be of much use to others. If you want to add any functionality, I wholeheartedly welcome it.

Documentation

Index

Constants

View Source
const API_ENDPOINT = "https://www.flickr.com/services/rest/"

Variables

This section is empty.

Functions

This section is empty.

Types

type Input

type Input struct {
	FlickrAPIKey             string
	Query                    string
	OutputDir                string
	NumberOfImages           int
	ForceReload              bool
	IncludeAllRightsReserved bool
	verbose.Verbose
}

func (*Input) Execute

func (i *Input) Execute() (*Output, error)

type Output

type Output struct {
	Files []attributions.AttributedFilePointer
}

type Photo

type Photo struct {
	XMLName   xml.Name `xml:"photo"`
	Id        string   `xml:"id,attr"`
	Owner     string   `xml:"owner,attr"`
	Title     string   `xml:"title,attr"`
	Ownername string   `xml:"ownername,attr"`
	Secret    string   `xml:"secret,attr"`
	Server    string   `xml:"server,attr"`
	License   int
	PhotoInfo PhotoInfo
}

type PhotoInfo

type PhotoInfo struct {
	XMLName      xml.Name       `xml:"photo"`
	DateUploaded int64          `xml:"dateuploaded,attr"`
	License      int            `xml:"license,attr"`
	Owner        PhotoInfoOwner `xml:"owner"`
	Title        string         `xml:"title"`
	Description  string         `xml:"description"`
	FlickrUrl    string         `xml:"urls>url"`
}

type PhotoInfoOwner

type PhotoInfoOwner struct {
	XMLName  xml.Name `xml:"owner"`
	Id       string   `xml:"nsid,attr"`
	UserName string   `xml:"username,attr"`
	RealName string   `xml:"realname,attr"`
}

type Photos

type Photos struct {
	XMLName xml.Name `xml:"photos"`
	Page    int32    `xml:"page,attr"`
	Pages   int32    `xml:"pages,attr"`
	Total   int32    `xml:"total,attr"`
	Photos  []Photo  `xml:"photo"`
}

type Response

type Response struct {
	XMLName   xml.Name  `xml:"rsp"`
	Photos    Photos    `xml:"photos"`
	PhotoInfo PhotoInfo `xml:"photo"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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