I.T. Spices The LINUX Way

in blockchain •  6 years ago 

Python In The Shell: The STEEMIT Ecosystem – Post #116

SCRAPING ALL BLOGS USING PYTHON – THE POST DATE

Please refer to Post #110 for the complete python script and the intro of this series, link below:
https://steemit.com/blockchain/@lightingmacsteem/2rydxz-i-t-spices-the-linux-way

In this post we will be discussing how we arrived at the DATE of the blog post which will be one of the most important data as far as posts are concerned.

Lines 88 to 94 are the python codes directly involved in acquiring the blog’s DATE:

88
89          #DATE OF THE BLOG POST
90          postdate = str(post["created"].date())
91          print('\nPOST DATE:')
92          flogs.write('\nPOST DATE:')
93          print('   ' + postdate)
94          flogs.write('\n   ' + postdate)



Line 90 is a variable declared as postdate using the steem python Post module as previously defined. We have to tell python to format it as a date and made sure that it will be displayed as a string (str) so as to minimize any errors in the screen display and the writes into the log file.

Lines 91 to 94 are lines of python codes to print the results both on the screen and on the log file. Take note of the “\n” which means a newline, this creates a space (a new line of course) between each message whatever it might be.

This DATE data may be a small thing as of now, but just imagine if we want to get all blogs for a certain month, or year, or day? What about if we will arrive at a point where we want to make graphs out of blogs from a certain account?

Go figure.


”A Word May Mean Two Things; An Act May Be Perceived Both Ways…….”

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!