mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update Popular Science
This commit is contained in:
parent
860d1613bf
commit
9b2adfa777
@ -27,14 +27,16 @@ class AdvancedUserRecipe1282101454(BasicNewsRecipe):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def parse_section_index(self, slug):
|
def parse_section_index(self, slug):
|
||||||
soup = self.index_to_soup('https://www.popsci.com/{}/'.format(slug))
|
url = 'https://www.popsci.com/{}/'.format(slug)
|
||||||
main = soup.find(**classes('main-content'))
|
self.log('Section:', url)
|
||||||
for div in main.findAll(**classes('Post')):
|
soup = self.index_to_soup(url)
|
||||||
a = div.find('a', href=True, **classes('Post-link'))
|
main = soup.find(**classes('PostsContainer'))
|
||||||
|
for div in main.findAll(**classes('PostItem')):
|
||||||
|
a = div.find('a', href=True, **classes('PostItem-link'))
|
||||||
url = a['href']
|
url = a['href']
|
||||||
title = self.tag_to_string(div.find(**classes('Post-title')))
|
title = self.tag_to_string(div.find(**classes('PostItem-title')))
|
||||||
desc = ''
|
desc = ''
|
||||||
dek = div.find(**classes('Post-excerpt'))
|
dek = div.find(**classes('PostItem-excerpt'))
|
||||||
if dek is not None:
|
if dek is not None:
|
||||||
desc = self.tag_to_string(dek)
|
desc = self.tag_to_string(dek)
|
||||||
self.log(' ', title, url)
|
self.log(' ', title, url)
|
||||||
@ -48,7 +50,6 @@ class AdvancedUserRecipe1282101454(BasicNewsRecipe):
|
|||||||
'diy': 'DIY',
|
'diy': 'DIY',
|
||||||
'reviews': 'Reviews',
|
'reviews': 'Reviews',
|
||||||
}.items():
|
}.items():
|
||||||
self.log('Section:', title)
|
|
||||||
articles = list(self.parse_section_index(slug))
|
articles = list(self.parse_section_index(slug))
|
||||||
if articles:
|
if articles:
|
||||||
sections.append((title, articles))
|
sections.append((title, articles))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user