Coder Social home page Coder Social logo

hacker-news-mixin-bot's Introduction

Hacker News Mixin bot

Go implementation of Mixin bot that posts new hot Hacker News stories to Mixin Messeger

Build

  1. Obtain your own Mixin bot app key, fill config/config.go api key and secret...
  2. Got dependencies and run go build
  3. Launch two services ./hacker-news-mixin-bot -service blaze and ./hacker-news-mixin-bot -service news

hacker-news-mixin-bot's People

Contributors

crossle avatar dependabot[bot] avatar

Stargazers

 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

hacker-news-mixin-bot's Issues

service 'news' crashed after started for a few seconds

hxzdeMac-mini:~/workspace/golang/src/github.com/crossle/hacker-news-mixin-bot (master) $ ./hacker-news-mixin-bot -service news
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x42b6d48]

goroutine 1 [running]:
encoding/json.(*Decoder).refill(0xc42028a000, 0x4670680, 0xc420018101)
	/usr/local/go/src/encoding/json/stream.go:152 +0xe8
encoding/json.(*Decoder).readValue(0xc42028a000, 0x0, 0x0, 0x4013a68)
	/usr/local/go/src/encoding/json/stream.go:128 +0x275
encoding/json.(*Decoder).Decode(0xc42028a000, 0x45acec0, 0xc4200dcc40, 0x0, 0x0)
	/usr/local/go/src/encoding/json/stream.go:57 +0x78
github.com/crossle/hacker-news-mixin-bot/vendor/github.com/qube81/hackernews-api-go.GetStories(0x46a6e22, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/hxz/workspace/golang/src/github.com/crossle/hacker-news-mixin-bot/vendor/github.com/qube81/hackernews-api-go/api.go:67 +0x1e6
github.com/crossle/hacker-news-mixin-bot/services.getTopStoryId(0xc420251e28)
	/Users/hxz/workspace/golang/src/github.com/crossle/hacker-news-mixin-bot/services/news.go:31 +0x36
github.com/crossle/hacker-news-mixin-bot/services.(*NewsService).Run(0x4a2ede0, 0x49b12a0, 0xc4201b25d0, 0x49b12a0, 0xc4201b25d0)
	/Users/hxz/workspace/golang/src/github.com/crossle/hacker-news-mixin-bot/services/news.go:62 +0x34
github.com/crossle/hacker-news-mixin-bot/services.(*Hub).StartService(0xc4200dcc20, 0x7ffeefbffa79, 0x4, 0x0, 0x0)
	/Users/hxz/workspace/golang/src/github.com/crossle/hacker-news-mixin-bot/services/hub.go:37 +0x170
main.main()
	/Users/hxz/workspace/golang/src/github.com/crossle/hacker-news-mixin-bot/main.go:26 +0x114

can not run 'blaze' service

I built the souce code with my config/config.go:

package config

const (
	DatabasePath      = "./news.db"
	MixinClientId     = "17ab3368-1d48-44b0-a11d-f3b91a1e140d"
	MixinClientSecret = "3fd6c40e18569f2c16bfae3e01fb81dea1e5f66dff178fbe8bb44c74d61a6285"
	MixinPin          = "432834"
	MixinSessionId    = "36cd2c61-e35b-4dd8-97a7-6968c0cd913f"
	MixinPinToken     = "kbAlh7feq3a7inzpNZOWK0qZwZ+J/HG7ns6rwS1GuYwUJOK7WlUD1V7SVAAjgryyuEHZLsrFkcsoMn07jdc3oMU0NJMGSKbocPieHPOaQiCGAGrqhadLCgW94I15sBfQDhgaW6JN7GNX7ToruekdEVW2VC4cXASLJQ1YoyPjw5A="
	MixinPrivateKey   = `-----BEGIN RSA PRIVATE KEY-----
	MIICXAIBAAKBgQCr94AAZtAK9i94vElPLMKGUzxhSxtGFt6nklKQsBGGY3ut/o/t
	qRI+CEh7njRwSUa7PCO3Xlct2wv/TDT4Mn15JTCsQpj0ICcbvs3/PvSB5AzKMwi9
	WQ4I/YXRukJunCADsDQ23MTOzQaG8fc9Yg5GN6gF0IeLPNnznKl314e6WwIDAQAB
	AoGAWhoJxSwZYUTwRpBQ0N0g5wSBpHCXz7d33dD61biK1iEV0mqIuvtVBY+Nese/
	rf2Ww8+U3yTdBLe6p38kWc8Kkiy8hsYhCnfw8fvmnbfxQSJWHHZfVuFLVvIsO4qf
	MOK/xQflgptIZp589hxE1venAS0NUJSxRwwKucXRbuV5GIECQQDefYn/m/vABlCu
	xi/oVY/wcIxSyD4RF0aCpS+XOquOFnugTfQhM1q+YI1iGXP8NAn/ai43IjNgXskk
	q8fHo2ahAkEAxd3yIBlH7l1Yf4rY2N9hdMGw7/vtzwHtCdisWB8Zxnn1giPxKnNk
	8jeK4ulJ2VXSrpz1qK4nUUM5BHRmi8yLewJAVJAofDOAGvsLfXIsUUT8AWn1m50q
	IfrTvOIl1XfiLo4TDNm0GU5YhhVSh1+fOtNYnXBxAlmIZ29/SeXUd+d+IQJBAKmr
	xqJry1jFRswnvgdKlgFOznEbsTLfzemxmSf/k1S05CfytizWwutJYZluvtrVU1JU
	WfuJS0HNySjev8iFX90CQGYS67uDcEfETJT2Lqz5I8nbRZ9IXflyrlnwFlbh0+mJ
	6GcoPqMe2twppk4N8oZorwsPpCsbdp3mBNbTHUnsuGY=
	-----END RSA PRIVATE KEY-----`
)

then run:

hxzdeMac-mini:~/workspace/golang/src/github.com/crossle/hacker-news-mixin-bot (master) $ ./hacker-news-mixin-bot -service blaze
2018/10/12 17:42:57 start blaze
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x444e18b]

goroutine 1 [running]:
github.com/crossle/hacker-news-mixin-bot/vendor/github.com/MixinNetwork/bot-api-go-client.SignAuthenticationToken(0x46b98ce, 0x24, 0x46b98f2, 0x24, 0x46c64c0, 0x384, 0x46a6c22, 0x3, 0x46a69d5, 0x1, ...)
	/Users/hxz/workspace/golang/src/github.com/crossle/hacker-news-mixin-bot/vendor/github.com/MixinNetwork/bot-api-go-client/auth.go:28 +0x81b
github.com/crossle/hacker-news-mixin-bot/vendor/github.com/MixinNetwork/bot-api-go-client.connectMixinBlaze(0x46b98ce, 0x24, 0x46b98f2, 0x24, 0x46c64c0, 0x384, 0x4e00000, 0x0, 0x4a00d50)
	/Users/hxz/workspace/golang/src/github.com/crossle/hacker-news-mixin-bot/vendor/github.com/MixinNetwork/bot-api-go-client/blaze.go:187 +0xc0
github.com/crossle/hacker-news-mixin-bot/vendor/github.com/MixinNetwork/bot-api-go-client.Loop(0x49b11e0, 0xc42005c940, 0x49ab260, 0x4a2ede0, 0x46b98ce, 0x24, 0x46b98f2, 0x24, 0x46c64c0, 0x384, ...)
	/Users/hxz/workspace/golang/src/github.com/crossle/hacker-news-mixin-bot/vendor/github.com/MixinNetwork/bot-api-go-client/blaze.go:83 +0xba
main.StartBlaze(0xc420087540, 0x0, 0x0)
	/Users/hxz/workspace/golang/src/github.com/crossle/hacker-news-mixin-bot/blaze.go:27 +0x1f8
main.main()
	/Users/hxz/workspace/golang/src/github.com/crossle/hacker-news-mixin-bot/main.go:20 +0x183

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.