News Scrapper
We will continue to create a news scrapper with the knowledge we learn from our tools.
Getting The Links
r = requests.get(https://www.gazetaexpress.com/zgjedhjet2021/)
soup = BeautifulSoup(r.content, 'html.parser')
data = soup.findAll(element, attrs={'class': 'right-post-category'})
for div in data:
links = div.findAll('a')
for link in links:
if link.get('href'):
linksArray.append(link.get('href'))Getting The Content
for link in linksArray:
r = requests.get(link)
soup = BeautifulSoup(r.text, 'html.parser')
content = soup.find('div', attrs={'class': 'single__content'})
text = content.text.lower()
print(text.count(keyword))Last updated