Lazy Search is a command-line application that allows users to search the web for recent news articles on arbitrary topics. The application prompts the user for a topic, searches the web for suitable news articles using the News API, and provides the user with a list of the top 15 matching news articles, a CSV file containing the full list of matching articles, and an automatically generated summary of the article headlines.
-
Clone the repository:
git clone https://github.com/your-username/lazy-search.git
-
Navigate to the project directory:
cd lazy-search -
Install the required dependencies: Since the project is build with poetry, there is a poetry.lock file that contains all the dependencies. To install the dependencies, run the following command:
pip install . -
Obtain an API key from News API by registering on their website.
-
Store the API key in one of the following ways:
-
Set it as an environment variable named
NEWS_API_KEY. -
Create a
.envfile in the project directory and add the following line, replacing<your-api-key>with your actual API key:NEWS_API_KEY=<your-api-key>
-
When storing the key inside the
.envfile, you won't be able to use it systemwide. You will have to run the application from the project directory. -
Alternatively, you can pass the API key directly using the
-kor--api-keyoption (see below).
-
To search for news articles on a specific topic, use the following command syntax:
lazy_search "Topic1" "Topic2" "TopicXX"You can also specify the language using the -l or --language option:
lazy_search "Topic" -l "en"or
lazy_search "Topic" --language "en"If you haven't stored the API key in the environment variables or a .env file, you can pass it directly using the -k or --api-key option:
lazy_search "Topic" -k "<your-api-key>"or
lazy_search "Topic" --api-key "<your-api-key>"Lazy Search supports the following languages for searching news articles:
- German:
de - English:
en - Spanish:
es - French:
fr - Italian:
it - Dutch:
nl - Norwegian:
no - Portuguese:
pt - Russian:
ru - Swedish:
se
The application will provide the following outputs:
- A list of the top 15 matching news articles, including their titles, URLs, and publication dates, sorted by relevance with respect to the given topic.
- A CSV file named
articles.csvcontaining the full list of matching articles, including their titles, URLs, and publication dates. This file is written immediately after the search. - An automatically generated summary of the top 15 article headlines, along with a list of all named entities mentioned in the headlines, sorted by frequency.
Here's an example of how to use the Lazy Search application:
lazy_search "Artificial Intelligence" -l "en"This command will search for recent news articles on the topic of "Artificial Intelligence" in English. The application will then display the top 15 matching articles, write the full list of matching articles to a CSV file, and generate a summary of the article headlines with a list of named entities.