Cleanup previous PR
We cant rename recipe files as that will break users Fetch news subscriptions to the renamed recipe. Also optimize the recipe icons and move them into the icons subfolder. Apply some pep8 cleanup.
Before Width: | Height: | Size: 1.2 KiB |
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
|
||||
class Volkskrant(BasicNewsRecipe):
|
||||
title = 'Dilema'
|
||||
@ -42,9 +42,9 @@ class Volkskrant(BasicNewsRecipe):
|
||||
def parse_index(self):
|
||||
homepage_url = 'https://www.dilema.ro/'
|
||||
soup = self.index_to_soup(homepage_url)
|
||||
|
||||
|
||||
articles = []
|
||||
|
||||
|
||||
# .banner-container
|
||||
banner_container = soup.find('div', attrs={'class': 'banner-container'})
|
||||
container = banner_container.find('h5')
|
||||
@ -59,7 +59,7 @@ class Volkskrant(BasicNewsRecipe):
|
||||
content=''
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
# .homepage_builder_3grid_post
|
||||
containers = soup.findAll('div', attrs={'class': 'homepage_builder_3grid_post'})
|
||||
for container in containers:
|
||||
@ -99,9 +99,9 @@ class Volkskrant(BasicNewsRecipe):
|
||||
body.clear()
|
||||
body.append(img)
|
||||
return soup
|
||||
|
||||
|
||||
def get_cover_url(self):
|
||||
url = 'https://www.dilema.ro/coperta-saptaminii/'
|
||||
soup = self.index_to_soup(url)
|
||||
img = soup.find(attrs={'id': 'main-carousel'}).find('img')
|
||||
return url + img.attrs['src']
|
||||
return url + img.attrs['src']
|
||||
|
BIN
recipes/icons/dilema.png
Normal file
After Width: | Height: | Size: 767 B |
BIN
recipes/icons/internazionale.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
recipes/icons/parool.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
recipes/icons/revista22.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 216 B After Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 1.6 KiB |
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||
|
||||
|
||||
class Volkskrant(BasicNewsRecipe):
|
||||
title = 'Internazionale'
|
||||
__author__ = 'Cristi Ghera'
|
||||
@ -32,11 +33,11 @@ class Volkskrant(BasicNewsRecipe):
|
||||
encoding = 'utf-8'
|
||||
no_stylesheets = True
|
||||
ignore_duplicate_articles = {'url'}
|
||||
|
||||
|
||||
current_number_url = "https://www.internazionale.it/sommario"
|
||||
home_url = "https://www.internazionale.it"
|
||||
cover_url = None
|
||||
|
||||
|
||||
def extract_article(self, article):
|
||||
url = article.find('a')['href']
|
||||
if url[0] == '/':
|
||||
@ -74,16 +75,16 @@ class Volkskrant(BasicNewsRecipe):
|
||||
sections.append(current_section)
|
||||
current_section = (self.tag_to_string(container), [])
|
||||
continue
|
||||
|
||||
|
||||
if 'masonry-items' in container['class']:
|
||||
for article in container.findAll('div', {'class': 'abstract-article'}):
|
||||
current_section[1].append(self.extract_article(article))
|
||||
continue
|
||||
|
||||
|
||||
if 'abstract-article' in container['class']:
|
||||
current_section[1].append(self.extract_article(container))
|
||||
continue
|
||||
|
||||
|
||||
# print(container['class'])
|
||||
if current_section:
|
||||
sections.append(current_section)
|
||||
@ -112,6 +113,6 @@ class Volkskrant(BasicNewsRecipe):
|
||||
# if self.browser.cookiejar:
|
||||
# self.browser.cookiejar.clear()
|
||||
return soup
|
||||
|
||||
|
||||
def get_cover_url(self):
|
||||
return self.cover_url
|
||||
return self.cover_url
|
||||
|
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 12 KiB |