Skip to content

Instantly share code, notes, and snippets.

@ariankordi ariankordi/adsense.go
Last active Sep 10, 2018

What would you like to do?
A little Go script that gets the AdSense revenue you have this month
package main
import (
var req = fasthttp.AcquireRequest()
var resp = fasthttp.AcquireResponse()
var client = &fasthttp.Client{}
//const cookie = "Paste the cookie you see when going to AdSense here, you have to uncomment this const"
func main() {
req.Header.Add("Client-Version", "44084f1953159cf725c5620637189f1689d48d6f")
req.Header.Add("X-Lightfe-Auth", "1")
req.Header.Add("Cookie", cookie)
client.Do(req, resp)
thisMonthPart1 := bytes.Split(resp.Body(), []byte("month "))[1]
thisMonthPart2 := bytes.Split(thisMonthPart1, []byte("$"))[1]
thisMonthPart3 := bytes.Split(thisMonthPart2, []byte("\""))[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.