mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Athens News by DM. Fixes #803663 (New recipe for Greek newspaper in English - Athens News)
This commit is contained in:
parent
85e1bac13b
commit
bd4462cfb7
70
recipes/athens_news.recipe
Normal file
70
recipes/athens_news.recipe
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2011, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
|
'''
|
||||||
|
www.athensnews.gr
|
||||||
|
'''
|
||||||
|
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class AthensNews(BasicNewsRecipe):
|
||||||
|
title = 'Athens News'
|
||||||
|
__author__ = 'Darko Miletic'
|
||||||
|
description = 'Greece in English since 1952'
|
||||||
|
publisher = 'NEP Publishing Company SA'
|
||||||
|
category = 'news, politics, Greece, Athens'
|
||||||
|
oldest_article = 1
|
||||||
|
max_articles_per_feed = 200
|
||||||
|
no_stylesheets = True
|
||||||
|
encoding = 'utf8'
|
||||||
|
use_embedded_content = False
|
||||||
|
language = 'en_GR'
|
||||||
|
remove_empty_feeds = True
|
||||||
|
publication_type = 'newspaper'
|
||||||
|
masthead_url = 'http://www.athensnews.gr/sites/athensnews/themes/athensnewsv3/images/logo.jpg'
|
||||||
|
extra_css = """
|
||||||
|
body{font-family: Arial,Helvetica,sans-serif }
|
||||||
|
img{margin-bottom: 0.4em; display:block}
|
||||||
|
.big{font-size: xx-large; font-family: Georgia,serif}
|
||||||
|
.articlepubdate{font-size: small; color: gray; font-family: Georgia,serif}
|
||||||
|
.lezanta{font-size: x-small; font-weight: bold; text-align: left; margin-bottom: 1em; display: block}
|
||||||
|
"""
|
||||||
|
|
||||||
|
conversion_options = {
|
||||||
|
'comment' : description
|
||||||
|
, 'tags' : category
|
||||||
|
, 'publisher' : publisher
|
||||||
|
, 'language' : language
|
||||||
|
, 'linearize_tables' : True
|
||||||
|
}
|
||||||
|
|
||||||
|
remove_tags = [
|
||||||
|
dict(name=['meta','link'])
|
||||||
|
]
|
||||||
|
keep_only_tags=[
|
||||||
|
dict(name='span',attrs={'class':'big'})
|
||||||
|
,dict(name='td', attrs={'class':['articlepubdate','text']})
|
||||||
|
]
|
||||||
|
remove_attributes=['lang']
|
||||||
|
|
||||||
|
|
||||||
|
feeds = [
|
||||||
|
(u'News' , u'http://www.athensnews.gr/category/1/feed' )
|
||||||
|
,(u'Politics' , u'http://www.athensnews.gr/category/8/feed' )
|
||||||
|
,(u'Business' , u'http://www.athensnews.gr/category/2/feed' )
|
||||||
|
,(u'Economy' , u'http://www.athensnews.gr/category/11/feed')
|
||||||
|
,(u'Community' , u'http://www.athensnews.gr/category/5/feed' )
|
||||||
|
,(u'Arts' , u'http://www.athensnews.gr/category/3/feed' )
|
||||||
|
,(u'Living in Athens', u'http://www.athensnews.gr/category/7/feed' )
|
||||||
|
,(u'Sports' , u'http://www.athensnews.gr/category/4/feed' )
|
||||||
|
,(u'Travel' , u'http://www.athensnews.gr/category/6/feed' )
|
||||||
|
,(u'Letters' , u'http://www.athensnews.gr/category/44/feed')
|
||||||
|
,(u'Media' , u'http://www.athensnews.gr/multimedia/feed' )
|
||||||
|
]
|
||||||
|
|
||||||
|
def print_version(self, url):
|
||||||
|
return url + '?action=print'
|
||||||
|
|
||||||
|
def preprocess_html(self, soup):
|
||||||
|
for item in soup.findAll(style=True):
|
||||||
|
del item['style']
|
||||||
|
return soup
|
BIN
recipes/icons/athens_news.png
Normal file
BIN
recipes/icons/athens_news.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 514 B |
@ -48,6 +48,12 @@ class Table(object):
|
|||||||
|
|
||||||
class OneToOneTable(Table):
|
class OneToOneTable(Table):
|
||||||
|
|
||||||
|
'''
|
||||||
|
Represents data that is unique per book (it may not actually be unique) but
|
||||||
|
each item is assigned to a book in a one-to-one mapping. For example: uuid,
|
||||||
|
timestamp, size, etc.
|
||||||
|
'''
|
||||||
|
|
||||||
def read(self, db):
|
def read(self, db):
|
||||||
self.book_col_map = {}
|
self.book_col_map = {}
|
||||||
idcol = 'id' if self.metadata['table'] == 'books' else 'book'
|
idcol = 'id' if self.metadata['table'] == 'books' else 'book'
|
||||||
@ -66,6 +72,13 @@ class SizeTable(OneToOneTable):
|
|||||||
|
|
||||||
class ManyToOneTable(Table):
|
class ManyToOneTable(Table):
|
||||||
|
|
||||||
|
'''
|
||||||
|
Represents data where one data item can map to many books, for example:
|
||||||
|
series or publisher.
|
||||||
|
|
||||||
|
Each book however has only one value for data of this type.
|
||||||
|
'''
|
||||||
|
|
||||||
def read(self, db):
|
def read(self, db):
|
||||||
self.id_map = {}
|
self.id_map = {}
|
||||||
self.extra_map = {}
|
self.extra_map = {}
|
||||||
@ -91,6 +104,12 @@ class ManyToOneTable(Table):
|
|||||||
|
|
||||||
class ManyToManyTable(ManyToOneTable):
|
class ManyToManyTable(ManyToOneTable):
|
||||||
|
|
||||||
|
'''
|
||||||
|
Represents data that has a many-to-many mapping with books. i.e. each book
|
||||||
|
can have more than one value and each value can be mapped to more than one
|
||||||
|
book. For example: tags or authors.
|
||||||
|
'''
|
||||||
|
|
||||||
def read_maps(self, db):
|
def read_maps(self, db):
|
||||||
for row in db.conn.execute(
|
for row in db.conn.execute(
|
||||||
'SELECT book, {0} FROM books_{1}_link'.format(
|
'SELECT book, {0} FROM books_{1}_link'.format(
|
||||||
|
@ -109,6 +109,7 @@ _extra_lang_codes = {
|
|||||||
'en_AU' : _('English (Australia)'),
|
'en_AU' : _('English (Australia)'),
|
||||||
'en_NZ' : _('English (New Zealand)'),
|
'en_NZ' : _('English (New Zealand)'),
|
||||||
'en_CA' : _('English (Canada)'),
|
'en_CA' : _('English (Canada)'),
|
||||||
|
'en_GR' : _('English (Greece)'),
|
||||||
'en_IN' : _('English (India)'),
|
'en_IN' : _('English (India)'),
|
||||||
'en_TH' : _('English (Thailand)'),
|
'en_TH' : _('English (Thailand)'),
|
||||||
'en_CY' : _('English (Cyprus)'),
|
'en_CY' : _('English (Cyprus)'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user