Posts

Showing posts from April, 2021

News Article Scraping || Python || BeautifulSoup

I was learning about Sentiment Analysis and for that purpose, I was in need of news article in CSV format, so now to get those news articles in CSV format I came up with the solution of  Web scraping those articles with the help of a python library called " BeautifulSoup " which is a  Python package for parsing HTML and XML documents. It creates a parse tree for parsed pages that can be used to extract data from HTML, which is useful for web scraping. Now, how & what I did is shown here below in the code. #Importing libraries import  urllib.request,sys,time from  bs4  import  BeautifulSoup import  requests import  pandas  as  pd pagesToGet=  1 upperframe=[]   for  page  in   range ( 1 ,pagesToGet+ 1 ):      print ( 'processing page :' , page)     url =  'https://www.marketwatch.com/markets?mod=top_nav/?page=' +str(page)   ...