Skip to content

Python rss-reader allow to read feeds from given url, store them in local storage, printout news as html or pdf document. Some specific options are described in README.md

Notifications You must be signed in to change notification settings

ElenaNKn/RSS_reader

Repository files navigation

Description

This application is Python RSS-reader. It is implemented to read news from a given feed with prescribed arguments.

Requirements

The application requires the next Python libraries to be installed:
fpdf
requests
beautifulsoup4
lxml
jsonlines
python-dateutil
colorama

Necessary libraries may be installed by entering the next command in a command line:
pip install library_name

Running

User can run the application from a command line (from a folder, where scripts of rss_reader are situated) in two ways:

  • running the script itself (if all requirements are installed) by a command:
    python rss_reader.py source [--version] [--json] [--verbose] [--limit LIMIT] [--date DATE] [--html HTML] [--pdf PDF] [-h]
    positional arguments:
    source
    RSS URL
    optional arguments:
    --version
    Print version info
    --json
    Print result as JSON in stdout
    --verbose
    Outputs verbose status messages
    --limit LIMIT
    Limit news topics if this parameter provided
    --date DATE
    Print result from a cash for a given date
    --html HTML
    Print result to HTML file
    --pdf PDF
    Print result to PDF file
    -h, --help
    Show a help message and exit
  • installing of application by a command:
    python setup.py develop
    The application may be then run by a command:
    rss_reader source [--version] [--json] [--verbose] [--limit LIMIT] [--date DATE] [--html HTML] [--pdf PDF] [-h]

* About a JSON structure

This application generates JSON with the next structure:
{"feed": "Name of sourse feed",
"news": [
{
"title": "title of news_1",
"pubdate": "publication date of a news_1",
"link": "sourse link for a news_1",
"description": "Short description of a content of a news_1"
},
{
"title": "title of news_2",
"pubdate": "publication date of a news_2",
"link": "sourse link for a news_2",
"description": "Short description of a content of a news_2"
},
...
]}

** About a cashed news storage structure

A cashed news storage is provided by a file dates.json and folders cashed_feeds and cashed_img.
When rss_reader is started without a --date argument, dates of publication of news are stored in the file dates.json together with path to file, where all news for this date are stored. All news (including title, link, date of publication, description, feed name, URL of media content, if a new has it, and path to media file in storage) are stored in the folder cashed_feeds. Media content of stored news is stored in the folder cashed_img. Names of files in the folder cashed_feeds corresponds to dates of publication of news.
When rss_reader is started with --date argument, it reads news from the cash for entered date and source.

*** Additional remarks

A folder font contains a font for creating a PDF result file. A file rss_downloads.html contains initial template for creating a HTML result file.

Running tests

User can run tests from a command line (from a folder, where scripts of rss_reader are situated) by a command:
python -m unittest discover

About

Python rss-reader allow to read feeds from given url, store them in local storage, printout news as html or pdf document. Some specific options are described in README.md

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published