Grab latest technology news by just writing nine lines of code in "Python"!
In today's era who would don't like to learn about technology? .The latest trending hot topics like Machine learning, Data Science, Big data, and Data visualization. these are such technologies that are taking the world to the next level.
The person who might be reading this may be a computer nerd or expert or a student like me. So to be updated we must read the treading topics of upcoming updates and technology
But I know you very well!. Going to the website or reading articles or even in-shorts sounds troublesome. So the best and fun solution is that we can read the news programmatically.
To do this I have used the requests module and JSON module
Here the major part is to get the API key by creating an account on the news API website.
requests. get(URL) -- it visits the provided URL and collects the HTML content of the web page brings it in the python code. But we need the title from the news
So to do that, I have used JSON built-in function JSON.loads()-- it is used to convert JSON string into a python dictionary.
then after traversing the JSON file and grab the articles from it. from that article, we print the main title. after that you can modify it as you want in this I have numbered each title and capitalized starting letters to make it more readable.
Comments
Post a Comment