2 more indentation fixes and fixed icons size
Before Width: | Height: | Size: 475 B After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1018 B |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1018 B |
@ -47,6 +47,6 @@ class KrytykaPolitycznaRecipe(BasicNewsRecipe):
|
||||
def preprocess_html(self, soup):
|
||||
for alink in soup.findAll('a'):
|
||||
if alink.string is not None:
|
||||
tstr = alink.string
|
||||
alink.replaceWith(tstr)
|
||||
tstr = alink.string
|
||||
alink.replaceWith(tstr)
|
||||
return soup
|
||||
|
@ -15,7 +15,7 @@ class naszdziennik(BasicNewsRecipe):
|
||||
no_stylesheets = True
|
||||
|
||||
keep_only_tags =[dict(attrs = {'id' : 'article'})]
|
||||
|
||||
|
||||
#definiujemy nową funkcje; musi zwracać listę feedów wraz z artykułami
|
||||
def parse_index(self):
|
||||
#adres do parsowania artykułów
|
||||
@ -28,7 +28,7 @@ class naszdziennik(BasicNewsRecipe):
|
||||
sections = []
|
||||
#deklaracja pierwszej sekcji jako pusty string
|
||||
section = ''
|
||||
|
||||
|
||||
#pętla for, która analizuje po kolei każdy tag "news-article"
|
||||
for item in soup.findAll(attrs = {'class' : 'news-article'}) :
|
||||
#w tagu "news-article szukamy pierwszego taga h4"
|
||||
@ -51,11 +51,11 @@ class naszdziennik(BasicNewsRecipe):
|
||||
#jako tytuł użyty będzie tekst pomiędzy tagami <a>
|
||||
article_title = self.tag_to_string(article_a)
|
||||
#a data będzie tekstem z pierwszego taga h4 znalezionego w tagu title-datetime
|
||||
article_date = self.tag_to_string(article_title_datetime.find('h4'))
|
||||
article_date = self.tag_to_string(article_title_datetime.find('h4'))
|
||||
#zebrane elementy dodajemy do listy zadeklarowanej w linijce 44
|
||||
articles[section].append( { 'title' : article_title, 'url' : article_url, 'date' : article_date })
|
||||
#po dodaniu wszystkich artykułów dodajemy sekcje do listy feedów, korzystając z list sekcji znajdujących się w słowniku
|
||||
for section in sections:
|
||||
feeds.append((section, articles[section]))
|
||||
#zwracamy listę feedów, której parsowaniem zajmie się calibre
|
||||
return feeds
|
||||
return feeds
|
||||
|