Keep getting RSS on the command line

Keep getting RSS on the command line py

newsfeeds.PNG

I almost got the sauce from here. [Search Make. Get RSS of the manufacturing site you want to make](http://make.bcde.jp/python/rss%E3%82%92%E5%8F%96%E5%BE%97%E3 % 81% 99% E3% 82% 8B /)

Use conda to install feedparser conda install feedparser

Click here for documentation feedparser 5.2.0 documentation

get_feed.py


from datetime import datetime
from time import mktime
import feedparser
from tqdm import tqdm
from time import sleep

#RSS URL
RSS_URL = "http://www.fxstreet.jp/rss/news/forex-news/"

#Get RSS
feed = feedparser.parse(RSS_URL)

#RSS title
print(feed.feed.title, '\n')


while True:
	try:
		for entry in tqdm(range(len(feed.entries))):
			#Process RSS contents one by one
			title = feed.entries[entry].title
			link = feed.entries[entry].link

			#Get update date as a string
			published_string = feed.entries[entry].published

			#Get update date as datetime
			tmp = feed.entries[entry].published_parsed
			published_datetime = datetime.fromtimestamp(mktime(tmp))

			#display
			print(title)
			print(link)
			print(published_string)
			print(published_datetime)
			print('\n')
			sleep(1)
	except KeyboardInterrupt:
		break

Added behavior

TODO

BUGS

Recommended Posts

Keep getting RSS on the command line
You search commandlinefu on the command line
Quickly display the QR code on the command line
Arduino development on the command line: vim + platformio
Syntax highlighting on the command line using Pygments
Convert XLSX to CSV on the command line
Operate Route53 on the command line using AWS-CLI.
Think about the selective interface on the command line
Search for large files on Linux from the command line
Python standard module that can be used on the command line
Get, test, and submit test cases on the command line in the AtCoder contest
Look up your Mac's Wi-Fi network name (SSID) on the command line
Frequently used (personally) notes on the tar command
The story of misreading the swap line of the top command
My thoughts on python2.6 command line app template
Correspondence memo when the direction key cannot be used on the python command line
How to pass arguments when invoking python script from blender on the command line
Steps to use the AWS command line interface (Python / awscli) on Mac OS X
How to create an article from the command line
Open Chrome version of LINE from the command line [Linux]
Execute the command on the web server and display the result
Multiply PDF by OCR on command line on Linux (Ubuntu)
(Remember quickly) How to use the LINUX command line
I tried to notify the honeypot report on LINE
Command line introductory notes
About the service command
Install the pip command
Linux command line shortcut
Use Python 3 introduced with command line tools on macOS Catalina
Let's execute the command on time with the bot of discord
[Jinja2] Changes in line breaks depending on the hyphen position
"Let Python do the boring things" exercise ~ Command line mailer ~
[Python] I tried to make a simple program that works on the command line using argparse.