Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 02-17-2017, 03:43 PM   #1
erkfuizfeuadjfjz
Member
erkfuizfeuadjfjz began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Feb 2017
Device: Sony PRS-T3
Recipe voor De Tijd (Belgian newspaper) based on built in recipe of Darko Miletic

#!/usr/bin/env python2

__license__ = 'GPL v3'
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
'''
www.tijd.be
'''
from calibre.web.feeds.news import BasicNewsRecipe
from calibre.ebooks.BeautifulSoup import Tag


class DeTijd(BasicNewsRecipe):
title = 'De Tijd'
__author__ = 'Darko Miletic'
description = 'News from Belgium in Dutch'
publisher = 'De Tijd'
category = 'news, politics, Belgium'
oldest_article = 2
max_articles_per_feed = 100
no_stylesheets = True
use_embedded_content = False
encoding = 'utf-8'
language = 'nl_BE'

lang = 'nl-BE'
direction = 'ltr'

html2lrf_options = [
'--comment', description, '--category', category, '--publisher', publisher
]

html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + \
category + \
'"\noverride_css=" p {text-indent: 0cm; margin-top: 0em; margin-bottom: 0.5em} "'

keep_only_tags = [
dict(name='div', attrs={'id': 'lcol'}),
dict(name='div', attrs={'class':'l-main-container-article__asset-container'}),
dict(name='div', attrs={'class':'l-main-container-article__body clearfix highlightable '}),
dict(name='div', attrs={'class':'l-main-container-article__intro highlightable '}),
dict(name='div', attrs={'class':'l-main-container-article__sidebar-inline'}),
dict(name='div', attrs={'class':'l-main-container-article__title '})
]
remove_tags = [
dict(name=['embed', 'object']), dict(
name='div', attrs={'id': 'art_reactwrap'})
]
remove_tags_after = dict(name='div', attrs={'id': 'art_author'})

feeds = [

(u'Volledig nieuwsaanbod', u'http://www.tijd.be/rss/nieuws.xml'),
(u'Markten', u'http://www.tijd.be/rss/markten.xml'),
(u'Ondernemingen', u'http://www.tijd.be/rss/ondernemingen.xml'),
(u'Chemie-Farma', u'http://www.tijd.be/rss/chemie_farma.xml'),
(u'Consumptie', u'http://www.tijd.be/rss/consumptie.xml'),
(u'Diensten', u'http://www.tijd.be/rss/diensten.xml'),
(u'Energie', u'http://www.tijd.be/rss/energie.xml'),
(u'Financen', u'http://www.tijd.be/rss/financien.xml'),
(u'Industrie', u'http://www.tijd.be/rss/industrie.xml'),
(u'Media', u'http://www.tijd.be/rss/media_telecom.xml'),
(u'Technologie', u'http://www.tijd.be/rss/technologie.xml'),
(u'Economie & Financien', u'http://www.tijd.be/rss/economie.xml'),
(u'Binnenland', u'http://www.tijd.be/rss/binnenland.xml'),
(u'Buitenland', u'http://www.tijd.be/rss/buitenland.xml'),
(u'De wijde wereld', u'http://www.tijd.be/rss/cultuur.xml')
]

def preprocess_html(self, soup):
del soup.body['onload']
for item in soup.findAll(style=True):
del item['style']
soup.html['lang'] = self.lang
soup.html['dir'] = self.direction
mlang = Tag(soup, 'meta', [
("http-equiv", "Content-Language"), ("content", self.lang)])
mcharset = Tag(soup, 'meta', [
("http-equiv", "Content-Type"), ("content", "text/html; charset=utf-8")])
soup.head.insert(0, mlang)
soup.head.insert(1, mcharset)
return soup
erkfuizfeuadjfjz is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Modify Built-In Recipe to Eliminate Images? huladaddy Recipes 12 08-17-2014 11:48 PM
Alter built-in recipe for IP-based authentication barium Recipes 0 05-19-2012 03:20 AM
Utne Reader built-in recipe not working dexy Recipes 0 08-30-2011 06:56 PM
Tricky problem with built-in recipe - need your help.... :( stachuman Recipes 3 05-04-2011 04:08 PM
Adding a feed to the built-in NY Times recipe t0s Recipes 3 03-03-2011 12:26 PM


All times are GMT -4. The time now is 04:09 AM.


MobileRead.com is a privately owned, operated and funded community.