diff --git a/recipes/icons/newsminute.png b/recipes/icons/newsminute.png new file mode 100644 index 0000000000..5544ac433e Binary files /dev/null and b/recipes/icons/newsminute.png differ diff --git a/recipes/newsminute.recipe b/recipes/newsminute.recipe new file mode 100644 index 0000000000..ac675581a9 --- /dev/null +++ b/recipes/newsminute.recipe @@ -0,0 +1,70 @@ +from calibre.web.feeds.news import BasicNewsRecipe, classes +from calibre.ptempfile import PersistentTemporaryFile + + +class newsminute(BasicNewsRecipe): + title = 'The News Minute' + __author__ = 'unkn0wn' + description = ( + 'The News Minute is a digital news platform reporting and writing on issues in India, with a ' + 'specific focus on the 5 southern states. Our content includes news, ground reportage, news ' + 'analysis, opinion and blogs. Our core strengths include our deep access in the southern states, ' + 'incisive editorial acumen and insightful news analysis and opinions.' + ) + language = 'en_IN' + + no_stylesheets = True + remove_javascript = True + masthead_url = 'https://pkcindia.com/wp-content/uploads/2021/09/TMN-Logo-1.png' + ignore_duplicate_articles = {'title', 'url'} + resolve_internal_links = True + remove_empty_feeds = True + remove_attributes = ['style', 'height', 'width'] + articles_are_obfuscated = True + + def get_obfuscated_article(self, url): + br = self.get_browser() + try: + br.open(url) + except Exception as e: + url = e.hdrs.get('location') + soup = self.index_to_soup(url) + link = soup.find('a', href=True) + skip_sections =[ # add sections you want to skip + '/video/', '/videos/', '/media/', 'podcast-' + ] + if any(x in link['href'] for x in skip_sections): + self.log('Aborting Article ', link['href']) + self.abort_article('skipping video links') + + self.log('Downloading ', link['href']) + html = br.open(link['href']).read() + pt = PersistentTemporaryFile('.html') + pt.write(html) + pt.close() + return pt.name + + keep_only_tags = [ + classes( + 'arr--section-name arr--story--headline-h1 arr--sub-headline arr--hero-image author-card-wrapper arr--story-page-card-wrapper' + ), + ] + + feeds = [] + + sections = [ + 'tamil-nadu', 'telangana', 'andhra-pradesh', 'karnataka', 'kerala' + ] + + for sec in sections: + a = 'https://news.google.com/rss/search?q=when:27h+allinurl:https%3A%2F%2Fwww.thenewsminute.com{}&hl=en-IN&gl=IN&ceid=IN:en' + feeds.append((sec.capitalize(), a.format('%2F' + sec + '%2F'))) + feeds.append(('Others', a.format(''))) + + def populate_article_metadata(self, article, soup, first): + article.title = article.title.replace(' - The News Minute', '') + + def preprocess_html(self, soup): + for img in soup.findAll('img', attrs={'data-src':True}): + img['src'] = img['data-src'] + return soup diff --git a/recipes/project_syndicate.recipe b/recipes/project_syndicate.recipe index a87ea0d9a1..5091865961 100644 --- a/recipes/project_syndicate.recipe +++ b/recipes/project_syndicate.recipe @@ -61,9 +61,9 @@ class projectsynd(BasicNewsRecipe): def preprocess_html(self, soup): for img in soup.findAll('img', attrs={'old-src':True}): img['src'] = img['old-src'].replace('medium', 'xlarge') - if abs := soup.find(attrs={'itemprop':'abstract'}): - abs.name = 'p' - abs['class'] = 'sub' + if abst := soup.find(attrs={'itemprop':'abstract'}).find('div'): + abst.name = 'p' + abst['class'] = 'sub' for div in soup.findAll('div', attrs={'data-line-id':True}): div.name = 'p' for a in soup.findAll('a', href=True):