View Single Post
Old 06-29-2022, 02:56 AM   #2
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
another update

update eenadu https://github.com/kovidgoyal/calibr.../eenadu.recipe

To remove older articles add
Code:
from datetime import date, datetime, timedelta
from calibre.utils.date import parse_date

def preprocess_html(self, soup):
        div = soup.find('div', **classes('pub-t'))
        if div:  
            date = parse_date(
                self.tag_to_string(div)
                    .strip().replace('Published : ','').replace('Updated : ','').replace(' IST',':00.000001')
                ).replace(tzinfo=None)
            today = datetime.now()
            if (today - date) > timedelta(1.5):
                self.abort_article('Skipping old article')
        else: # may not be an artilce.
            self.abort_article()
        return soup
and replace lines 55-61 with

Code:
# Finding all the section titles that are acceptable
        for x in nav_div.findAll(['a']):
            if self.is_accepted_entry(x):
                sec = self.tag_to_string(x)
                link = x['href']
                if link.endswith('telangana'):
                    sec = 'తెలంగాణ'
                if link.endswith('andhra-pradesh'):
                    sec = 'ఆంధ్రప్రదేశ్'
                if link.endswith('andhra-pradesh/districts'):
                    sec = 'ఆంధ్రప్రదేశ్.. ఆసక్తికర జిల్లా వార్తలు'
                if link.endswith('telangana/districts'):
                    sec = 'తెలంగాణ.. ఆసక్తికర జిల్లా వార్తలు'
                section_list.append((sec, link))
        feeds = []
unkn0wn is offline   Reply With Quote