Is the below question a good fit for https://softwareengineering.stackexchange.com/ ? If not, is it worth a place in StackOverflow site ? If not again, in what StackExchange site can I ask it ?
Question Title :Python- scraping news articles on daily basis from sites that do not have any feed
Question body: I can use Python Beautiful Soup module to extract news items from a site feed URL. But suppose the site has no feed and I need to extract news articles from it on daily basis as if it had a feed.
Edit 1: The site https://www.jugantor.com/ has no feed. Even by googling, I did not find any feed of this site . With the following code snippet, I tried to extract the links from the site . The result shows links such as 'http://epaper.jugantor.com' But the news items appearing on the site are nor included in the extracted links.
My Code:
from bs4 import BeautifulSoup
from urllib.request import Request, urlopen
import re
def getLinks(url):
USER_AGENT = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5'
request = Request(url)
request.add_header('User-Agent', USER_AGENT)
response = urlopen(request)
content = response.read().decode('utf-8')
response.close()
soup = BeautifulSoup(content, "html.parser")
links = []
for link in soup.findAll('a', attrs={'href': re.compile("^http://")}):
links.append(link.get('href'))
return links
print(getLinks("https://www.jugantor.com/"))
Obviously this does not serve the intended purpose. I need all the news article links of 'https://www.jugantor.com/' on a daily basis as if I acquire them from a feed.
How can I do that ? Any python module or algorithm etc ?
Addendum The question was asked on Stackoverflow in between and got an answer.