Hntoebook - Converts the best HN stories to .mobi format to be read using an e-reader

HN to E-Book

Shows screenshot of HN stories on Kindle

What?

This program converts the best HN stories to .mobi format to be read using an e-reader.

Why?

My Hacker News knowledge assimilation stack.

TL;DR

I read HN on my kindle as I find it useful for reading under sun(while walking in a controlled environment) and taking notes. I was running hntokindle.com to offer this as a service for others.

But Amazon has recently made sending bulk emails to the Kindle impossible by requiring 2FA over registered Amazon email address for each item sent to the Kindle.

Hence I've stripped down HN to Kindle code to enable local transfer to any e-book reader which supports .mobi format and made the project open-source.

How

  1. Retrieve HN stories using official API with a Go wrapper.
  2. Filter best(Determined by HN) stories older than 9 hours but lesser than 24 hours with at least 20 comments and top comment older than 2 hours.
  3. Convert the HTML to .pdf after applying cosmetic changes using WKhtmlTopdf with a Go wrapper.
  4. Convert the .pdf to .mobi using Calibre command line tool.
  5. Place the .mobi file on the device.
  6. Store the item id in the K,V database to prevent duplicates.

Requirements

  1. WKhtmlTopdf
  2. Calibre CLI
  3. hntoebook

Usage

Operating System

  1. Linux amd64 (Tested)
  2. Linux arm64 (Not tested)
  3. darwin amd64 (Not tested)
  4. darwin arm64 (Not tested)
  5. windows amd64 (Not tested)

Set the path to store the .mobi file on the e-book reader

./hntoebook -c

Run hntoebook

./hntoebook

Send particular HN story or HN comment to the e-book reader

./hntoebook -i

Feature parity with HN To Kindle

Email

Local file transfer is used instead of Email.

Send HN item to Kindle

Individuals HN item (Story or Comment) can be sent to the e-book reader.

Category Filter

Filtering is not implemented as it requires python server for classifier with large sized models. If there's enough interest for the feature then I will include it in the project.

Misc

No web server, Relational database, Concurrency etc. as there's no need for user accounts or subscriptions.

Troubleshooting

Errors with mobiPath

Make sure that the path for .mobi files on E-Reader ends with a trailing slash / .

Database errors

Delete the db folder and start again. If you were using < v0.0.3 and upgraded to v0.0.3 then the db folder needs to be deleted regardless of any error as v0.0.3 uses new database.

License

The MIT License

Copyright 2022 ABISHEK MUTHIAN

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Owner
Abishek Muthian
Helping to build products which people want with https://needgap.com, https://hitstartup.com, https://startuptoolchain.com.
Abishek Muthian
Similar Resources

Sync your bank transactions with google sheets using Open Banking APIs

Sync your bank transactions with google sheets using Open Banking APIs

Jul 22, 2022

Sync your bank transactions with google sheets using Open Banking APIs

this is a markdown version of the copy on the site landing page: https://youneedaspreadsheet.com You need a spreadsheet 📊 Get on top of your finances

Jul 22, 2022

Extend KIND networking capabilities with plugins using the KIND API

kind-networking-plugins Plugins to extend KIND networking capabilities with plugins using the KIND API These plugins were used for the Kubecon EU 2021

Nov 10, 2022

A simple APIRest to Star Wars character using Golang (gin,gorm)

A simple APIRest to Star Wars character using Golang (gin,gorm)

A simple APIRest to Star Wars character using Golang (gin,gorm)

Sep 23, 2021

Leave Discord servers using the folder names.

leavemealone ------------ Leave Discord servers using the folder names. Usage ----- 1. `export TOKEN="token"` 2. `go run . folder_name` 3. Chec

Feb 4, 2022

planet is a blockchain built using Cosmos SDK and Tendermint and created with Starport.

planet planet is a blockchain built using Cosmos SDK and Tendermint and created with Starport. Get started starport chain serve serve command install

Oct 31, 2021

AWS Mock with using GO SDK V2 middleware

AWS Mock with using GO SDK V2 middleware

Dec 17, 2021

A package for access aws service using AWS SDK for Golang

goaws 🚀 A package for access aws service using AWS SDK for Golang Advantage with goaws package Example for get user list IAM with AWS SDK for Golang

Nov 25, 2021

Helps me find good enough stocks that pay enough dividends using IEX Cloud data provider.

divyield Helps me find good enough stocks that pay enough dividends using IEX Cloud data provider. Create database using the postgres/scripts/createdb

Feb 4, 2022
Comments
  • Go Code suggestions

    Go Code suggestions

    :wave: Hello

    I saw your project was using my HackerNews API bindings go-hn and wanted to contribute some changes back to improve the readability of the go code. This is not criticism of your code by any means and mostly represents Effective Go suggestions.

    I've tried to keep each commit specific to a few ideas, reading the commits individually will be a lot easier than scrolling through the entire PR. Don't feel inclined to merge this PR for whatever reason, I did this mostly for fun :slightly_smiling_face:

    Further suggestions

    • It would be a good idea to take a stab at removing all of the log.Print/Fatal and instead bubble errors back up through your application using return fmt.Errorf("something went wrong: %w") so that all of the context of an error will be wrapped up together when you log it higher up. Blog post about error wrapping
    • Prefer having a small main function that kicks off the control flow for the application, right now there's a lot to read to get a picture of how the application works.
    • Function signatures like story *stories.Story, storyItem *hnapi.Story, commentItem *hnapi.Comment are usually a hint that you might want to write an interface to find the common denominator between the types you're passing around.
    • Use a linter like golangci-lint and make it easy to run locally and on the repository via GitHub actions or another CI platform if you'd like.
    • A lot of the diff in this PR is related to reducing indentation. I see this project uses badger, take a look through the source and you'll rarely see more than 2-3 indentations.
    • Right now this code seems hard to write automated tests for (such as UpdateStories). If you pass in a client rather than create one in that function you could more easily pass in a "fake" client that you could use to respond with bad data or just prefer to pass in all the data that function needs rather than have it do a lookup.
A Hacker News reader focused on content and readability.

HN.HSBLHSN.ME A HackerNews reader written in Go and React. It focuses on content and readability. Demo You can check the final result here at https://

Oct 16, 2022
DiscSpam is the best free and open source tool to spam/raid Discord servers.
DiscSpam is the best free and open source tool to spam/raid Discord servers.

DiscSpam Fast, Free, Easy to use Discord.com raid tool Report Bug , Request Feature About The Project There are a few Discord raid tools on GitHub, ho

Dec 27, 2022
Dynamodb-expire-non-latest - Dynamodb spike to find best solution to set expire on old records

Goal, expire non-latest records User (identified by IP address), adds record A,

Jan 5, 2022
Read the text of memes, then inject that text into the image as searchable metadata.
Read the text of memes, then inject that text into the image as searchable metadata.

Make Meme Text Searchable I have an extensive set of memes I've been collecting since the early days of Flickr. #icanhascheeseburger It's a pain in th

May 2, 2022
The telegram bot for reading and synchronizing notes in markdown format

notesbot The telegram bot for reading and synchronizing notes in markdown format.

Mar 13, 2022
Simple CRUD API written in Go, built using AWS SAM tool and using the AWS' infrastructure.
Simple CRUD API written in Go, built using AWS SAM tool and using the AWS' infrastructure.

tutor-pet API Simple CRUD API written in Go, built using AWS SAM tool and using the AWS' infrastructure. Macro architecture: Code architecture: Pre-Re

Aug 17, 2022
Asteroids written in Golang using raylib using an ECS system.

Asteroids written in Golang using Raylib using an ECS system.

Feb 12, 2022
Firebase Cloud Messaging for application servers implemented using the Go programming language.

Firebase Cloud Notifications Client Firebase Cloud Messaging for application servers implemented using the Go programming language. It's designed for

Dec 17, 2022
Google Cloud Messaging for application servers implemented using the Go programming language.

gcm The Android SDK provides a nice convenience library (com.google.android.gcm.server) that greatly simplifies the interaction between Java-based app

Sep 27, 2022
Simple no frills AWS S3 Golang Library using REST with V4 Signing (without AWS Go SDK)

simples3 : Simple no frills AWS S3 Library using REST with V4 Signing Overview SimpleS3 is a golang library for uploading and deleting objects on S3 b

Nov 4, 2022