Package: daily-rss-news
Python RSS ReaderInstallationTo install this package type$pipinstalldaily-rss-news==5.0.4or if you have already installed previous version type$pipinstall--upgradedaily-rss-newsIf you do not want to install it , you can clone source code from gitlab$gitclonehttps://gitlab.com/Ilhom_Xusanov/RSS-parser.gitRequirementsThis program depends on some third party packages.
If you downloaded it from gitlab, first create virtual environment
and go to the folder where requirements.txt resides and type$pipinstall-rrequirements.txtThis will install all packages to run this program.UsageIf you installed this packages by pip, you can use it everywhere
by typing$rss-reader[options]or$python-mrss_reader[options]If you downloaded from gitlab, go to root folder where rss_reader.py is,
and you can run python with rss_reader.py module.Noteif you are in different folder specify full path to rss_reader.py to run with python$pythonrss_reader.py[options]To see help message type$rss-reader-hor$pythonrss_reader.py-houtput is:─╯
usage:rss-reader[-h][--version][--json][--verbose][--limit][--date][--to-pdf][--to-html][--clear-cache][--colorize[{red,green,blue,yellow,magenta,black,cyan}]][source]PurePythoncommand-lineRSSreader

positionalarguments:sourceRSSURL

optionalarguments:-h,--helpshowthishelpmessageandexit--versionPrintversioninfo--jsonPrintresultasJSONinstdout--verboseOutputsverbosestatusmessages--limit[]Limitnewstopicsifthisparameterprovided--date[]PublisheddateofnewsinformatYYYYMMDD--to-pdf[]Directoryandfilenamewherepdffileisstored--to-html[]Directoryandfilenamewherehtmlfileisstored--clear-cacheClearsallnewsfromcache--colorize[{red,green,blue,yellow,magenta,black,cyan}]PrintsstdoutinacoloredmodeIf --version option is given, program prints its version to console and exits.If --verbose option is given, outputs logs in a INFO level, default is WARNINGif --limit(N) option is given, N number of news, else all news is returnedif --date option is provided with date in format YYYYMMDD , then news published that date will be returnedif -- date option is provided with given source , then only news published in a given date from that source will be returnedif --to-pdf 'file path' or --to-html 'file path' is given,
converts news into given format and saves in a given 'file path'if --clear-cache option is given, all news in cache are removedif --colorize option is given, news will be displayed in green to console. Default is white.if --json option is provided, program displays news to console in json format--json output example:$pythonrss_reader/rss_reader.pyhttp://rss.cnn.com/rss/edition.rss--json--limit2─╯{"title":"CNN.com - RSS Channel - App International Edition","pubDate":"Tue, 12 Apr 2022 18:23:43 GMT","link":"https://www.cnn.com/app-international-edition/index.html","image":{"title":"CNN.com - RSS Channel - App International Edition","link":"https://www.cnn.com/app-international-edition/index.html","url":"http://i2.cdn.turner.com/cnn/2015/images/09/24/cnn.digital.png"},"description":"CNN.com delivers up-to-the-minute news and information on the latest top stories, weather, entertainment, politics and more.","news_list":[{"title":"Putin: Talks with Ukraine are at a 'dead end'","pubDate":"No info","link":"https://edition.cnn.com/webview/europe/live-news/ukraine-russia-putin-news-04-12-22/h_c91c00763f131bbeed411565ee0b6319","image":"No info","description":"No info"},{"title":"'People often cry during their questioning': CNN speaks to woman investigating Russian war crimes","pubDate":"Tue, 12 Apr 2022 01:05:09 GMT","link":"https://www.cnn.com/videos/world/2022/04/11/russia-war-crimes-investigation-evidence-tapper-lead-dnt-vpx.cnn","image":"No info","description":"CNN speaks with investigators and Ukrainian witnesses who testified about the brutality they witnessed by the Russian military for prosecutors building a case to charge Russia with war crimes."}]}CachingRetrieved news are cached. Cache file is in home directory called 'cache.db'.
Caching technique is accomplished via shelve library. To get news from cache internet connection is not required.
Each source is the key of shelve file 'cache.db'. Its value is list of news.Cache is going to grow in size continuously when you read news from rss sources.
To clear cache typeCaching imagesDirectory named image_cache will be created in user's home directory to store feeds' images
in cache. If feed has image, it will be stored in image_cache directory. When --date option is
available images will be displayed from that directory.$python-mrss_reader--clear-cacheFile convertingProgram supports two file converting formats pdf and html. To convert news into file formats,
give either --to-pdf or --to-html and file path where file is created. Give your file path
relative to your current working directory, like if you are in:$home/user/and giving file path 'custom_dir/file.pdf' will create custom_dir directory if not exists and
saves news into file.pdf.If file path is not given, it will not convert to given file formats. Instead, just prints news to consoleNoteRetrieving news from cache without specifying source returns all feeds and their news_list.
In that case, temporary files file_{feed_number}.pdf are created in user's home directory,
merged into given file path and removed.While converting to html files, give unique file names. Because it will not override existing files
like pdf, instead it appends news to the end of html file.Output colorizing--colorize option is available to print news in a colored mode. It takes one argument, color,
and prints news in a given color, default is white. Type -h option to see all available colorsTo colorize outputs package named colorama was used, and it is supposed to work well with default
terminals in Linux and Mac, default cmd in WindowsTested Rss links1.http://feeds.wired.com/wired/index2.http://feeds.nytimes.com/nyt/rss/Technology3.http://feeds.nature.com/nature/rss/current4.http://newsrss.bbc.co.uk/rss/newsonline_world_edition/americas/rss.xml5.http://feeds.nytimes.com/nyt/rss/HomePage6.https://news.yahoo.com/rss/7.http://feeds1.nytimes.com/nyt/rss/Sports8.http://rss.cnn.com/rss/edition.rssTestingTested moduleslog.pyrss_reader.pyarg_parser.pyTest coverage is 57%To run tests go to root folder of program and type:$python-mpytestto run tests in a specific module type:$python-mpytest'folder/modulename'to check test coverage run :$python-mpytest--cov=rss_reader/