View Single Post
Old 02-19-2022, 02:30 AM   #5
unkn0wn
Guru
unkn0wn understands the Henderson-Hasselbalch Equation.unkn0wn understands the Henderson-Hasselbalch Equation.unkn0wn understands the Henderson-Hasselbalch Equation.unkn0wn understands the Henderson-Hasselbalch Equation.unkn0wn understands the Henderson-Hasselbalch Equation.unkn0wn understands the Henderson-Hasselbalch Equation.unkn0wn understands the Henderson-Hasselbalch Equation.unkn0wn understands the Henderson-Hasselbalch Equation.unkn0wn understands the Henderson-Hasselbalch Equation.unkn0wn understands the Henderson-Hasselbalch Equation.unkn0wn understands the Henderson-Hasselbalch Equation.
 
Posts: 630
Karma: 85520
Join Date: May 2021
Device: kindle
Quote:
Originally Posted by unkn0wn View Post
I found that Saturday edition of Live Mint is called Lounge which has feeds from a whole another website.

so I created a new recipe for this weekly edition


Code:
#!/usr/bin/env  python

from calibre.web.feeds.news import BasicNewsRecipe, classes


class Lounge(BasicNewsRecipe):
    title = u'Live Mint-Lounge'
    language = 'en_IN'
    __author__ = 'unkn0wn'
    oldest_article = 7  # days
    max_articles_per_feed = 50
    encoding = 'utf-8'
    use_embedded_content = False
    no_stylesheets = True
    remove_attributes = ['style', 'height', 'width']

    keep_only_tags = [
        dict(name='h1'),
		dict(name='h2', attrs={'id':'story-summary-0'}),
        dict(name='picture'),
		dict(name='div', attrs={'class':'innerBanCaption'}),
		dict(name='div', attrs={'id':'date-display-before-content'}),
        dict(name='div', attrs={'class':'storyContent'}),
    ]
    remove_tags = [
        classes(
            'sidebarAdv similarStoriesClass moreFromSecClass'
        )
    ]

    feeds = [
        ('News', 'https://lifestyle.livemint.com/rss/news'),
        ('Food','https://lifestyle.livemint.com/rss/food'),
		('Fashion','https://lifestyle.livemint.com/rss/fashion'),
		('How to Lounge','https://lifestyle.livemint.com/rss/how-to-lounge'),
		('Smart Living','https://lifestyle.livemint.com/rss/smart-living'),
    ]

    def preprocess_html(self, soup):
        for img in soup.findAll('img', attrs={'data-src': True}):
            img['src'] = img['data-src']
        for img in soup.findAll('img', attrs={'data-img': True}):
            img['src'] = img['data-img']
        return soup


calibre_most_common_ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36'
LiveMint-Lounge.recipe
unkn0wn is offline   Reply With Quote