• Stars
    star
    164
  • Rank 228,849 (Top 5 %)
  • Language
    Go
  • License
    BSD 3-Clause "New...
  • Created about 12 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

golang reddit api wrapper

geddit

GoDoc Go Report Card Build Status

Geddit is a convenient abstraction for the reddit.com API in Go. This library is a WIP. It should have some API coverage, but does not yet include things like the new OAuth model.

examples

See godoc for OAuth examples.

Here is an example usage of the old, cookie authentication method:

(NOTE: You will be heavily rate-limited by reddit's API when using cookies. Consider switching to OAuth).

package main

import (
	"fmt"

	"github.com/jzelinskie/geddit"
)

// Please don't handle errors this way.
func main() {
	// Login to reddit
	session, _ := geddit.NewLoginSession(
		"novelty_account",
		"password",
		"gedditAgent v1",
	)

	// Set listing options
	subOpts := geddit.ListingOptions{
		Limit: 10,
	}

	// Get reddit's default frontpage
	submissions, _ := session.DefaultFrontpage(geddit.DefaultPopularity, subOpts)

	// Get our own personal frontpage
	submissions, _ = session.Frontpage(geddit.DefaultPopularity, subOpts)

	// Get specific subreddit submissions, sorted by new
	submissions, _ = session.SubredditSubmissions("hockey", geddit.NewSubmissions, subOpts)

	// Print title and author of each submission
	for _, s := range submissions {
		fmt.Printf("Title: %s\nAuthor: %s\n\n", s.Title, s.Author)
	}

	// Upvote the first post
	session.Vote(submissions[0], geddit.UpVote)
}

More Repositories

1

faq

Format Agnostic jQ -- process various formats with libjq
Go
434
star
2

conventions

documentation package for Go conventions
Go
98
star
3

homebrew-duckdns

automatically update duckdns via launchd on OSX
Ruby
35
star
4

dotfiles

my hidden config files
Lua
33
star
5

whirlpool

whirlpool cryptographic hashing library
Go
27
star
6

cuddlefs

Kubernetes userspace filesystem
Go
21
star
7

w8

unix utility for waiting on ports, http status, and more
Rust
7
star
8

pascal-p2

A mirror of Niklaus Wirth's P2 Pascal Compiler
Pascal
7
star
9

dango

a composable framework for BitTorrent trackers
Go
7
star
10

kademlia

A maximally flexible Kademlia DHT
Go
5
star
11

cobrautil

A collection of utility functions when using Cobra.
Go
5
star
12

readgroup

synchronization for reading the same io.Reader concurrently
Go
4
star
13

monokai-soda.vim

monokai soda vim theme
Lua
4
star
14

imgor

an s3 powered image hosting webapp
Go
4
star
15

grpcwebproxy

Improbable's grpcwebproxy with improved UX.
Go
4
star
16

must

utility functions that panic when an assumption isn't met
Go
4
star
17

q

the search for a flexible SQL query composition library for Go
Go
4
star
18

awesome-windows-opinionated

An awesome & opinionated list of best applications and tools for Windows
3
star
19

move_torrents.py

Find and replace filepaths in qBittorrent v3.3+
Python
3
star
20

iocage-plugin-murmur

iocage plugin for mumble servers
Shell
2
star
21

jzelinskie.github.com

my blog
HTML
2
star
22

homebrew-go-get

install go binaries with brew
Ruby
2
star
23

benchpress

Go
2
star
24

reflexd

Automate your torrent client based on the filesystem
Python
1
star
25

gochugaru

A SpiceDB client library striving to be as ergonomic as possible
Go
1
star
26

JDWM

My custom patched DWM 5.8.2
C
1
star
27

persistent

various persistent data structures
Go
1
star
28

stringz

additional string manipulations
Go
1
star