09-12-2015, 11:39 AM | #1 |
Enthusiast
Posts: 32
Karma: 10
Join Date: Sep 2013
Location: DE
Device: Linux PC's, Android devices, Amazon Fire HD10
|
PressePortal_DE Recipe - latest News and local Police News!
Hi, folks,
here is another nice little recipe for 'our' calibre. It will give you a daily news. Most of the tag, in the recipe are commended or self-explanatory. Feel free to test, modify and use. May, kovidgoyal or someone else put it into the recipe-list of the calibre program, so that everybody can use that after next update. kindly regards VoHegg ________________ Recipe file as Text _____________________ Code:
#!/usr/bin/env python2 # vim:fileencoding=utf-8 from __future__ import unicode_literals, division, absolute_import, print_function from calibre.web.feeds.news import BasicNewsRecipe from datetime import datetime class PressePortalDE(BasicNewsRecipe): # Titel of the Recipe title = 'Presseportal DE' # Author __author__ = 'Volker Heggemann, VoHe' # oldes article to download (in days) ---- can be edit by user oldest_article = 1 # describes itself, ---- can be edit by user max_articles_per_feed = 100 # speed up the download on fast computers be carefull (I test max.20) ---- can be edit by user simultaneous_downloads = 10 #description, some Reader show this in titlepage description = u'Presseportal News Feed DE' #add date to description so for dayly downloads you can find them easier ---- can be edit by user description = description +' fetched: ' + datetime.now().strftime("%Y-%m-%d") # %H:%M:%S") #Who published the content? publisher = u'Presseportal.de' #What is the content of? category = u'latest news, national Police, Germany' # describes itself, ---- can be edit by user use_embedded_content = False # describes itself, ---- can be edit by user language = 'de' #encoding of content. e.g. utf-8, None, ... ---- can be edit by user encoding = None # 'utf-8' doesn't work here # Removes javascript- why keep this, we only want static content remove_javascript = True # Removes empty feeds - why keep them!? remove_empty_feeds = True #some formatations for lrf and epub files html2lrf_options = [ '--comment', description , '--category', category , '--publisher', publisher ] html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"' #The cover Picture of the book. Here I use a local picture, but it's possible to use a link, too cover_url = '/home/user/.config/calibre/eigene_icons/presseportal.png' #cover_url = 'http://www.cleantechrelations.com/images/Presseportal.jpg' #remove the rubbish (in ebook) auto_cleanup = True #now the content description and URL follows # feel free to add, wipe out what you need ---- can be edit by user # # some of this are double # so if you load "Alle Ressort" you don't need "Wirtschaft, Finanzen, Politik, Vermischtes..." at all. # # # Make some tests, may you first comment all of them out, and step by step you add what you'll need? # feeds = [ #Ressorts # Add or Remove the '#' symbol in front of line, to get or discard this rss-feed # # ---- each line can be edit by user # # (u'Alle Ressort',u'http://www.presseportal.de/rss/presseportal.rss2'), (u'Wirtschaft',u'http://www.presseportal.de/rss/wirtschaft.rss2'), (u'Finanzen',u'http://www.presseportal.de/rss/finanzen.rss2'), (u'Politik',u'http://www.presseportal.de/rss/politik.rss2'), (u'Vermischtes',u'http://www.presseportal.de/rss/vermischtes.rss2'), (u'Sport',u'http://www.presseportal.de/rss/sport.rss2'), (u'Kultur',u'http://www.presseportal.de/rss/kultur.rss2'), #Branchen (u'Arbeit',u'http://www.presseportal.de/rss/arbeit.rss2'), (u'Auto',u'http://www.presseportal.de/rss/auto.rss2'), (u'Banken',u'http://www.presseportal.de/rss/banken.rss2'), (u'Bildung',u'http://www.presseportal.de/rss/bildung.rss2'), (u'Bauwesen',u'http://www.presseportal.de/rss/bauwesen.rss2'), (u'Celebrities',u'http://www.presseportal.de/rss/celebrities.rss2'), (u'Chemie',u'http://www.presseportal.de/rss/chemie.rss2'), (u'Comuter',u'http://www.presseportal.de/rss/computer.rss2'), (u'Energie',u'http://www.presseportal.de/rss/energie.rss2'), (u'Fernsehn',u'http://www.presseportal.de/rss/fernsehn.rss2'), (u'Fussball',u'http://www.presseportal.de/rss/fussball.rss2'), (u'Gesundheit',u'http://www.presseportal.de/rss/gesundheit.rss2'), (u'Handel',u'http://www.presseportal.de/rss/handel.rss2'), (u'Immobilien',u'http://www.presseportal.de/rss/immobilien.rss2'), (u'Kinder',u'http://www.presseportal.de/rss/kinder.rss2'), (u'Lebensmittel',u'http://www.presseportal.de/rss/lebensmittel.rss2'), (u'Livestyle',u'http://www.presseportal.de/rss/livestyle.rss2'), (u'Logistik',u'http://www.presseportal.de/rss/logistik.rss2'), (u'Maschinenbau',u'http://www.presseportal.de/rss/maschinenbau.rss2'), (u'Medien',u'http://www.presseportal.de/rss/medien.rss2'), (u'Motorsport',u'http://www.presseportal.de/rss/motorsport.rss2'), (u'Ratgeber',u'http://www.presseportal.de/rss/ratgeber.rss2'), (u'Recht',u'http://www.presseportal.de/rss/recht.rss2'), (u'Soziales',u'http://www.presseportal.de/rss/soziales.rss2'), (u'Telekommunikation',u'http://www.presseportal.de/rss/telekommunikation.rss2'), (u'Touristik',u'http://www.presseportal.de/rss/touristik.rss2'), (u'Umwelt',u'http://www.presseportal.de/rss/umwelt.rss2'), (u'Unterhaltung',u'http://www.presseportal.de/rss/unterhaltung.rss2'), (u'Versicherung',u'http://www.presseportal.de/rss/versicherung.rss2'), (u'Wissenschaft',u'http://www.presseportal.de/rss/wissenschaft.rss2'), #Themen (u'Polizei (gesamt)',u'http://www.presseportal.de/rss/polizei.rss2'), (u'Bilder',u'http://www.presseportal.de/rss/98,306.rss2'), (u'Video',u'http://www.presseportal.de/rss/videocast.rss2'), (u'Audio',u'http://www.presseportal.de/rss/podcast.rss2'), (u'Investor Relations',u'http://www.presseportal.de/rss/ir.rss2'), (u'Presseschau',u'http://www.presseportal.de/rss/1043.rss2'), #Polizeipresse - Kommunal! (u'Polizei BW',u'http://www.presseportal.de/rss/polizei/laender/1.rss2'), (u'Polizei BY',u'http://www.presseportal.de/rss/polizei/laender/2.rss2'), (u'Polizei BE',u'http://www.presseportal.de/rss/polizei/laender/3.rss2'), (u'Polizei HB',u'http://www.presseportal.de/rss/polizei/laender/4.rss2'), (u'Polizei HH',u'http://www.presseportal.de/rss/polizei/laender/5.rss2'), (u'Polizei HE',u'http://www.presseportal.de/rss/polizei/laender/6.rss2'), (u'Polizei MV',u'http://www.presseportal.de/rss/polizei/laender/7.rss2'), (u'Polizei NI',u'http://www.presseportal.de/rss/polizei/laender/8.rss2'), (u'Polizei NW',u'http://www.presseportal.de/rss/polizei/laender/9.rss2'), (u'Polizei RP',u'http://www.presseportal.de/rss/polizei/laender/10.rss2'), (u'Polizei SH',u'http://www.presseportal.de/rss/polizei/laender/11.rss2'), (u'Polizei BUND',u'http://www.presseportal.de/rss/polizei/laender/12.rss2'), (u'Polizei SL',u'http://www.presseportal.de/rss/polizei/laender/13.rss2'), (u'Polizei SA',u'http://www.presseportal.de/rss/polizei/laender/14.rss2'), (u'Polizei TH',u'http://www.presseportal.de/rss/polizei/laender/15.rss2'), (u'Polizei ST',u'http://www.presseportal.de/rss/polizei/laender/16.rss2'), ] def print_version(self, url): # Separate the last part of the Url : http://www.presseportal.de/pm/70776/3120111 # tuple it in partitions (from the right) at the edges of # the '/' symbol : ('http://www.presseportal.de/pm/70776','/','3120111') # take the last of this tuples : '3120111' # and split this at the symbol '.' (if there) : ('3120111',) # from this take the first tuple. '3120111' side = (url.rpartition('/')[-1]).rsplit('.',1)[0] # print 'ConvertPrintURL from : ' + url + '/n to ' + side printurl='http://www.presseportal.de/print/' + side + '-print.html' return printurl it also attached as .zip file Last edited by VoHegg; 09-12-2015 at 11:43 AM. Reason: put in the source |
09-13-2015, 12:27 AM | #2 |
creator of calibre
Posts: 44,409
Karma: 23977332
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
Advert | |
|
05-16-2020, 03:17 AM | #3 |
Enthusiast
Posts: 32
Karma: 10
Join Date: Sep 2013
Location: DE
Device: Linux PC's, Android devices, Amazon Fire HD10
|
Doesnt' work anymore (on my ubuntu20.04)
Hi there,
sad to say, the "presseportal feed" does not work any more. I updated yesterday to ubuntu 20.04lts and after that to the latest calibre version. But i test the reciepe under a windows10 machine too. I got this error: ------- Using user agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36 Failed feed: Wirtschaft Traceback (most recent call last): File "/usr/lib/python3/dist-packages/mechanize/_urllib2_fork.py", line 1229, in do_open h.request(str(req.get_method()), str(req.get_selector()), req.data, File "/usr/lib/python3.8/http/client.py", line 1240, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/lib/python3.8/http/client.py", line 1286, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/lib/python3.8/http/client.py", line 1235, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/lib/python3.8/http/client.py", line 1006, in _send_output self.send(msg) File "/usr/lib/python3.8/http/client.py", line 946, in send self.connect() File "/usr/lib/python3.8/http/client.py", line 1409, in connect self.sock = self._context.wrap_socket(self.sock, File "/usr/lib/python3.8/ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "/usr/lib/python3.8/ssl.py", line 1040, in _create self.do_handshake() File "/usr/lib/python3.8/ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: WRONG_SIGNATURE_TYPE] wrong signature type (_ssl.c:1108) ------- and i guess that's something to do with the rss-side? Reachable under... 'https://www.presseportal.de/rss/presseportal.rss2?langid=1' |
05-16-2020, 03:26 AM | #4 |
creator of calibre
Posts: 44,409
Karma: 23977332
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
that's an ssl error, presumably the server has ssl misconfigured.
|
Tags |
germany, news, recipe |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Recipe for Los Angeles Times which includes California/Local News | toygate | Recipes | 3 | 05-30-2014 02:32 PM |
NYT Recipe vs NYT Latest News Sub | tesseraye | Recipes | 0 | 10-26-2013 11:47 AM |
Fairbanks Daily News-miner News Recipe Submission | rogerx | Recipes | 2 | 08-25-2011 07:30 PM |
New Fairbanks Daily News-miner News Recipe -- Need Date inclusion only | rogerx | Recipes | 5 | 08-24-2011 09:12 AM |