Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cloudydaiyz/deep-interest-validator
Scans HackerNews website for deeply interesting articles using Playwright and Cohere
https://github.com/cloudydaiyz/deep-interest-validator
cohere nodejs playwright
Last synced: 26 days ago
JSON representation
Scans HackerNews website for deeply interesting articles using Playwright and Cohere
- Host: GitHub
- URL: https://github.com/cloudydaiyz/deep-interest-validator
- Owner: cloudydaiyz
- Created: 2024-06-21T23:00:17.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-07-21T17:34:46.000Z (4 months ago)
- Last Synced: 2024-10-06T08:42:43.364Z (about 1 month ago)
- Topics: cohere, nodejs, playwright
- Language: JavaScript
- Homepage:
- Size: 125 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# deep-interest-validator
Welcome to the Deep Interest Validator!This program logs in to [HackerNews](https://news.ycombinator.com/news) using the credentials that you specify, and validate that the first several articles are properly sorted using [Playwright](https://playwright.dev/). In addition to this, among those articles, articles that are considered "deeply interesting" are upvoted using the account credentials that you give.
My program uses [Cohere](https://cohere.com/) in order to classify articles as deeply interesting. For a more "formal" definition, look at HackerNews' definition of a deeply interesting article:
https://news.ycombinator.com/newswelcome.html#:~:text=A%20crap%20link,to%20be%20quieter.You may notice that I have delays in some places throughout the code:
`await page.waitForTimeout(1000);`
This is because sending requests to HackerNews too fast causes the website to block your traffic, as seen in `images/blocked.png`.
Finally, I have some tests for my program and HackerNews website in `tests/index.test.js`.
Have fun!## How to run
This program requires a couple of environment variables to be set:
- `DIV_HACKER_NEWS_USERNAME` - username of your HackerNews account
- `DIV_HACKER_NEWS_PASSWORD` - password of your HackerNews account
- `DIV_COHERE_API_KEY` - an API key of your Cohere account
- To get your own Cohere API key, [create a Cohere account](https://dashboard.cohere.com/welcome/login) and [navigate to API keys](https://dashboard.cohere.com/api-keys).Make sure that you have Node.js installed in order to run this program. First, call `npm install` to install the required modules.
From there, you have a couple of options:
- Run `npm start` to run the main program
- Run `npm test` to run the tests## For the future
If I want to continue this project in the future, I would add:
- support for the `analyze page` test
- functionality to automatically create a new HackerNews account
- adding a frontend## Technology used
Programming language(s): JavaScriptLibraries / Frameworks: Playwright, Cohere