Skip to content
forked from E-P-T/Homework

Homework for Python Foundation course

Notifications You must be signed in to change notification settings

fcumay/Homework

 
 

Repository files navigation

RSS reader

This is RSS reader version 4.0.

rss_reader.py is a python script intended to get RSS feed from given source URL and write its content to standart output also it's can convert content to .json and .html files.

To use this script you should install all required packages from requirements.txt

pip install {name of package}

How to execute after installation

Specifying the script file. Run from directory with rss_reader.py file the following command

Windows

python rss_reader.py ...

Linux

python3 rss_reader.py ...

Command line format

usage: python rss_reader.py [-h] [-v] [--json] [--verbose] [--limit LIMIT] [--date DATE] [--to-html ]
					 source

Pure Python command-line RSS reader.

positional arguments:
  source               RSS URL

optional arguments:
  -h, --help           show this help message and exit
  --version            Print version info
  --json               Print result as JSON
  --verbose            Outputs verbose status messages. Prints logs.
  --limit LIMIT        Limit news topics. If it's not specified, then you get all available feed.

  --date DATE          It should take a date in %Y%m%d format.The new from the specified day will be printed out.
  --html         It convert data to HTML-format in file output.html.

Сonsole representation

Name of the feed
Title from news
PubDate

Summary description

Source link

------------
Title from news
PubDate
...
.....

JSON representation

{
    "name": Name of the feed,
    "size": Number of available news,
    "title": [Names of available news],
    "pubDate": [Dates of publication news],
    "description": [Summary description],
    "link": [Link of source]
}

Cache storage format

News cache is stored in file data.json in current working directory.

Command example

python rss_reader.py "https://www.onliner.by/feed" --limit 1 --html

python rss_reader.py "https://www.buzzfeed.com/quizzes.xml" --limit 2 --json --verbose

python rss_reader.py "https://www.buzzfeed.com/quizzes.xml" --limit 3

python rss_reader.py  "https://feeds.fireside.fm/bibleinayear/rss" --limit 3 --verbose

python rss_reader.py --date 20220620

About

Homework for Python Foundation course

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 92.4%
  • HTML 7.6%