This commit is contained in:
Kovid Goyal 2023-06-12 22:24:37 +05:30
parent 68454456da
commit ce8b82f8dc
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -13,7 +13,7 @@ class mains(BasicNewsRecipe):
encoding = 'utf-8' encoding = 'utf-8'
ignore_duplicate_articles = {'url'} ignore_duplicate_articles = {'url'}
remove_attributes = ['height', 'width', 'style'] remove_attributes = ['height', 'width', 'style']
no_stylesheets = True no_stylesheets = True
resolve_internal_links = True resolve_internal_links = True
remove_empty_feeds = True remove_empty_feeds = True
use_embedded_content = False use_embedded_content = False
@ -28,17 +28,17 @@ class mains(BasicNewsRecipe):
def parse_index(self): def parse_index(self):
soup = self.index_to_soup('https://www.theindiaforum.in/') soup = self.index_to_soup('https://www.theindiaforum.in/')
ul = soup.find('ul', attrs={'class':'float-left'}) ul = soup.find('ul', attrs={'class':'float-left'})
section_list = [] section_list = []
for x in ul.findAll('a', href=True): for x in ul.findAll('a', href=True):
if '/podcast' in x['href']: if '/podcast' in x['href']:
continue continue
section_list.append( section_list.append(
(self.tag_to_string(x).strip().replace('■','■ '), 'https://www.theindiaforum.in' + x['href']) (self.tag_to_string(x).strip().replace('■','■ '), 'https://www.theindiaforum.in' + x['href'])
) )
feeds = [] feeds = []
for section in section_list: for section in section_list:
@ -50,7 +50,7 @@ class mains(BasicNewsRecipe):
if articles: if articles:
feeds.append((section_title, articles)) feeds.append((section_title, articles))
return feeds return feeds
def articles_from_soup(self, soup): def articles_from_soup(self, soup):
ans = [] ans = []
for art in soup.findAll('div', attrs={'class':lambda x: x and 'views-col' in x.split()}): for art in soup.findAll('div', attrs={'class':lambda x: x and 'views-col' in x.split()}):