News for hackers. Stuff that matters.
Re:Reddit's API Changes by costco on Friday May 26, 2023 @12:25PM (#36086240)
It would be a real shame if libreddit were to log the requests made by the Android app and try to replicate them, using this code to sign the "x-hmac-signed-body" and "x-hmac-signed-result" headers in https://accounts.reddit.com/api/login.

    func (c *Client) generateResultData(epoch int64) string {
        return fmt.Sprintf("Epoch:%d|User-Agent:%s|Client-Vendor-ID:%s", epoch, c.userAgent, c.clientVendorID)
    }

    func (c *Client) generateBodyData(epoch int64, body []byte) string {
        return fmt.Sprintf("Epoch:%d|Body:%s", epoch, string(body))
    }

    func hmacSignData(data string) string {
        digester := hmac.New(sha256.New, []byte(REDDIT_ANDROID_HMAC_SECRET))
        digester.Write([]byte(data))
        return hex.EncodeToString(digester.Sum(nil))
    }

    REDDIT_ANDROID_OAUTH_CLIENT_ID = "ohXpoqrZYub1kg"
    REDDIT_ANDROID_HMAC_SECRET = "8c7abaa5f905f70400c81bf3a1a101e75f7210104b1991f0cd5240aa80c4d99d"
And then use:

    https://oauth.reddit.com/r/%s/about.json
    https://oauth.reddit.com/r/%s/top.json
    https://oauth.reddit.com/search.json
etc.
Re:Reddit's API Changes by kif on Friday May 26, 2023 @03:09PM (#36088378)
A real shame indeed ;)
Re:Reddit's API Changes by rc202402 on Friday June 02, 2023 @02:02PM (#36168609)
I also did a little digging on this in 2018, this api allows more granular api control.

There's cool little parameters like rich text element, and other RPAN generally not available to the normal api.

Re:Reddit's API Changes by htmlcoderexe on Friday June 02, 2023 @02:07PM (#36168693)
This may come in handy later, thank you.
Re:Reddit's API Changes by sodality2 on Monday June 05, 2023 @04:47PM (#36203360)
Sigaloid here (from the linked thread). 1. I can't believe I missed this thread! 2. this is amazing, I _just_ opened an issue looking into the GQL API, but you've done some great work here. I cannot thank you enough. This will help enormously! Hopefully we can prepare for the changes properly.