Skip to content

Latest commit

 

History

History
81 lines (48 loc) · 4.55 KB

readme.md

File metadata and controls

81 lines (48 loc) · 4.55 KB

Hacker Reads

Browser extension that adds Hacker News comments to books on Goodreads.

Comments on Hacker News are one of my favorite places for discovering new books!

I can sometimes go from having never heard of a book, to immediately reading one, because of a HN comment. When it comes to Goodreads user reviews, however, they are rarely able to convince me to read a book.

This extension attempts to fix this problem by placing relevant HN comments underneath book pages in Goodreads which allows you to find out, quickly, what other HN users think of a book you're browsing on Goodreads.


Install

Screenshot

Screenshot

How it works

When you visit a Goodreads book page this extension uses the Algolia HN search API (https://hn.algolia.com/api) to search for a combination of the book name and author.

When searching with the API, it seems that being less specific is often better, that is, if you want to search for a book like "Clean Code: A Handbook of Agile Software Craftsmanship" you will not get you that many comments from the Algolia API if you include "A Handbook of Agile Software Craftsmanship." What's more, if you just search for "Clean Code", without "Robert C. Martin" there are tons of irrelevant results that rightly do contain the words "Clean Code".

What seems to work pretty well, and what I'm using right now, is the query 'bookTitle bookAuthor' - where the 'bookTitle' is the book's title minus any subtitle it might have. This is done by naively chopping off anything after a title's colon, if it has one.

Roadmap

Here are some things I'd like to add or improve:

  • Searching via ISBN.
    • The reason I haven't used this strategy at all is because, curiously, though many people mention books on HN by linking to them on Amazon, which does contain the book's ISBN number, the links are often truncated, which means the ISBN is excluded from the searchable text in the comment. For example: searching 189200528 would not return this comment though it does have a link with that ISBN.
  • Authors with middle names (Robert C. Martin) often return less results when including their middle initial.
  • Book titles with brackets may return less results than expected.
  • Code formatting (<pre>) is sometimes weird.
  • An option to save individual comments to a private note or comment.
  • The way comment HTML is displayed. Currently using very hacky CSS rules which seem to work but I don't really know why.

Development

See the npm scripts in package.json for more information. To get started make sure Node.js® is installed. You can then clone the repo and install the project:

git clone https://github.com/spookyuser/hacker-reads
cd hacker-reads
npm install

If you want to play around with the project

npm run watch

This will make webpack watch for any changes and output the unpacked extension to /distribution/.
Now you're ready to start editing the project. You can go straight into /source/ and mess around if you want.

To see your changes I recommend using Firefox because it automatically reloads your changes and can be launched from the project by running:

npm run start:firefox

To build for production just run npm run build

Acknowledgements

My thanks go to all those mentioned in acknowledgements.md for any contributions that I used in this project.

I would also like to especially thank @sindresorhus and anyone else involved in refined-github for figuring out how to structure a modern web extension and making it easy to copy that structure :)

Contributing

Please see contributing.md. TL;DR: All are very welcome.

Related