Coder Social home page Coder Social logo

geddit's People

Contributors

aggrolite avatar akfaew avatar anaskhan96 avatar arbrown avatar ban3 avatar daniel-hoerauf avatar gabaroar avatar hsbakshi avatar jawshua avatar joshuathompson avatar jpclark avatar jzelinskie avatar mdp avatar nicholasault avatar robbyoconnor avatar schnouki avatar scord avatar seklfreak avatar solarnz avatar thegreatpanda avatar vteromero avatar wwkeyboard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geddit's Issues

The function SavedComments takes in a params / ListingOptions variable, but doesn't use it.

// SavedComments fetches comments saved by given username using OAuth.
func (o *OAuthSession) SavedComments(user string, params ListingOptions) ([]*Comment, error) {
	var s interface{}
	url := fmt.Sprintf("https://oauth.reddit.com/user/%s/saved", user)
	err := o.getBody(url, &s)
	if err != nil {
		return nil, err
	}

	helper := new(helper)
	helper.buildComments(s)
	return helper.comments, nil
}

As you can see above, the function takes in the variable params, but doesn't actually use it in the url, like the Listing function does with these lines.

p, err := query.Values(params)
if err != nil {
	return nil, err
}
url := fmt.Sprintf("https://oauth.reddit.com/user/%s/%s?%s", username, listing, p.Encode())

This means that for example using the After listing option to actually get more than five saved comments is not possible.
I might try fixing this myself, if I found out how to locally develop go modules.

http->https

Reddit now supports TLS, we should probably use it by default in all the URL literals.

Comment.go should use float in string() instead of decimal

Small thing, but lines 38-40

func (c Comment) String() string {
    return fmt.Sprintf("%s (%d/%d): %s", c.Author, c.UpVotes, c.DownVotes, c.Body)
}

Probably should be like this:

func (c Comment) String() string {
    return fmt.Sprintf("%s (%.0f/%.0f): %s", c.Author, c.UpVotes, c.DownVotes, c.Body)
}

Atm it prints out float64=number, which is kind hard to read :)

Sorry...

... wish there was better ways to socially interact with a repo than the issues tracker... but I just wanted to express my thanks for the code! Has enabled me to jump right into hacking on a little idea I had for a reddit bot.

I will take a look at OAuth support if someone else isn't already poking at it.

The Example(url) code fails

When I run the code from the Example(url) given on the godoc page it tells me to visit a reddit url. When I click on the link a browser window opens saying that I broke reddit. I'm running Ubuntu 22.

OAuth2 Support?

Does geddit has OAuth2 Support? Currently, I'm using I with plaintext username and password.

Hardcoded http.DefaultClient

Hardcoded http.DefaultClient prohibits the user from specifying custom timeouts, setting custom cookies etc. Especially the lack of timeouts is deadly as the default client never times out.

Reddit Comments

We're currently using a slapped together implementation to fetch comments from reddit.com. I'd like to completely model the whole thing out using static types and just encoding/json.Unmarshal() the whole thing. A lot of the complexity around the type hierarchy needed to parse the JSON can be hidden by struct embedding.

However, the "replies" field on comments either returns a list of objects or empty string if there are none. Sadly, I think this will require some kind of run-time type assertion.

Rate limits cause tests to fail

Forked the repo, cloned it, get the following upon running "go test":

--- FAIL: TestSubmit (1.08s)
    reddit_test.go:26: false
    reddit_test.go:53: failed to submit
    reddit_test.go:58: failed to submit
FAIL
exit status 1
FAIL    github.com/joshuathompson/geddit    1.866s

Apparently due to rate limits: "you are doing that too much. try again in x minutes.". It appears after a little research that maybe new accounts or accounts with no karma have stricter limitations.

Comments from a subreddit

I was wondering if there could be a feature to get a slice of Comment pointers from a subreddit directly, instead of a particular Submission. For example, if you go to reddit.com/r/golang/comments, you'll see all the comments posted in the subreddit, irrespective of the post.

This makes it easier to access all the comments if I were to build a bot, rather than looping through all the posts' comments and their replies.

Subreddit.DateCreated should have a bigger datatype

From subreddit.go#21

type Subreddit struct {
[...]
	DateCreated float32 `json:"created_utc"`
[...]
}

DateCreated float32 is to small for the timestamps the Reddit APi provides. Example:

  • Created Timestamp provided by API: 1478970533
  • Geddit is reducing this to: 1.4789705e+09 which is 1478970500

Which is 33 sec difference! I'd suggest to use int32 (-2147483648 to 2147483647) or uint32 (0 to 4294967295; since its a unix timestamp we wont need negative values).

However, since this repo hasn't been updated for a year now I have low hopes this will be changed. Nevertheless - I like the simplicity of geddits approach and its totally sufficient for my needs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.