View Single Post
Old 03-19-2022, 05:45 AM   #3
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
Code:
from calibre.web.feeds.news import BasicNewsRecipe
from datetime import datetime
     
class Seminar(BasicNewsRecipe):
    title = 'India-Seminar Magazine'
    __author__ = 'unkn0wn'
    description = 'Seminar - attempts a departure from the usual journal. Problems, national and international, are posed and discussed. Each issue deals with a single problem. Those who hold different and at times opposing viewpoints express their thoughts'
    language = 'en_GB'
    use_embedded_content = False
    remove_javascript = True
    masthead_url = 'https://www.india-seminar.com/semlogo/semlogo_top_1.jpg'
    
    
    
    ignore_duplicate_articles = {'url'}
        
    def parse_index(self):
        d = datetime.today()
        soup = self.index_to_soup('https://www.india-seminar.com/' + d.strftime('%Y') + '/751.htm')
        ans = []
        
        for a in soup.findAll('a', href=lambda x: x):
            url = a['href']
            if url.startswith('751/'):
                url = 'https://www.india-seminar.com/' + d.strftime('%Y') + '/' + url
            title = self.tag_to_string(a)
            self.log(title, ' at ', url)
            ans.append({'title': title, 'url': url})
        return [('Articles', ans)]
This works great.. but is there's a way to get the number to change with months..

like %m (is month number) and add it to 748

so that jan will be 748+1
dec will become 748+12
unkn0wn is offline   Reply With Quote