View the full sample newsletter in PDF format here.
The NewsCollector algorithm **scrapes** the source links provided and compares the articles it found based on their **similarity**. If it finds multiple articles from different sources covering similar topics, these will be considered as being **relevant articles** and will be included in the output newsletter.> :closed_book: Read more about how the algorithm of NewsCollector works in [my Medium article](https://medium.com/@eliselandman/automated-news-article-collection-with-python-9267968c9ea). ## Basic Usage You can run the NewsCollector algorithm as follows: ```Python from newscollector import * newsletter = NewsCollector() output = newsletter.create() ``` This will run the full NewsCollector pipeline by scraping the sources from the package default `sources.json` file and outputting an HTML newsletter. The `output` object will hold the location path of the generated newsletter, so that you can easily retrieve it programmatically: ```Python output > 'C:\\Output\\Path\\newsletter.html' ``` > :bulb: For a **detailed usage guide**, please refer to the official [NewsCollector Usage Documentation](https://github.com/elisemercury/News-Collector/wiki/NewsCollector-Usage-Documentation). ## CLI Usage The NewsCollector can also be run directly via the CLI with the following parameters: ```python newscollector.py [-h] [-s [SOURCES]] [-n [NEWS_NAME]] [-d [NEWS_DATE]] [-t [TEMPLATE]] [-o [OUTPUT_FILENAME]] [-a [AUTO_OPEN]] [-r [RETURN_DETAILS]] ``` ## Output The NewsCollector will output an **HTML newsletter** with the most **relevant articles** it found while scraping the sources provided.
View the full sample newsletter in PDF format here.
By default, the output newsletter will be **created as an HTML file** in the installation directory of your package, saved in the folder `rendered` under the filename `newsletter_YYYY-MM-DD.html`, where the date is the respective date the NewsCollector scraped its articles from. To adjust the default settings, please refer to [Additional Parameters](https://github.com/elisemercury/NewsCollector#additional-parameters). ## Additional Parameters You can customize the NewsCollector algorithm with the following optional parameters: ```Python newsletter = NewsCollector(sources="sources.json", news_name="Daily News Update", news_date=date.today(), template='newsletter.html', output_filename='default', auto_open=False, return_details=False) ``` > :bulb: For a **detailed usage guide**, please refer to the official [NewsCollector Usage Documentation](https://github.com/elisemercury/News-Collector/wiki/NewsCollector-Usage-Documentation). -------:heart: Open Source