diff --git a/src/libprs500/ebooks/lrf/web/__init__.py b/src/libprs500/ebooks/lrf/web/__init__.py index a110ca5d4d..2452d7b4d1 100644 --- a/src/libprs500/ebooks/lrf/web/__init__.py +++ b/src/libprs500/ebooks/lrf/web/__init__.py @@ -23,9 +23,11 @@ from libprs500.ebooks.lrf.web.profiles.zeitde import ZeitNachrichten from libprs500.ebooks.lrf.web.profiles.faznet import FazNet from libprs500.ebooks.lrf.web.profiles.wsj import WallStreetJournal from libprs500.ebooks.lrf.web.profiles.barrons import Barrons -from libprs500.ebooks.lrf.web.profiles.portfolio import Portfolio +from libprs500.ebooks.lrf.web.profiles.portfolio import Portfolio +from libprs500.ebooks.lrf.web.profiles.dilbert import Dilbert +from libprs500.ebooks.lrf.web.profiles.cnn import CNN -builtin_profiles = [Barrons, BBC, Economist, FazNet, Newsweek, NewYorkReviewOfBooks, NYTimes, \ +builtin_profiles = [Barrons, BBC, CNN, Dilbert, Economist, FazNet, Newsweek, NewYorkReviewOfBooks, NYTimes, \ Portfolio, SpiegelOnline, WallStreetJournal, ZeitNachrichten, \ ] diff --git a/src/libprs500/ebooks/lrf/web/profiles/cnn.py b/src/libprs500/ebooks/lrf/web/profiles/cnn.py new file mode 100644 index 0000000000..d3e151c318 --- /dev/null +++ b/src/libprs500/ebooks/lrf/web/profiles/cnn.py @@ -0,0 +1,63 @@ +## Copyright (C) 2007 Kovid Goyal kovid@kovidgoyal.net +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License along +## with this program; if not, write to the Free Software Foundation, Inc., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +''' +Profile to download CNN +''' +import re +from libprs500.ebooks.lrf.web.profiles import DefaultProfile + +class CNN(DefaultProfile): + + title = 'CNN' + max_recursions = 2 + timefmt = ' [%d %b %Y]' + html_description = True + no_stylesheets = True + oldest_article = 15 + + preprocess_regexps = [(re.compile(i[0], re.IGNORECASE | re.DOTALL), i[1]) for i in [ + (r'.*?.*?', lambda match : ''), + (r'', lambda match : ''), + (r'<\!\-\-Article End\-\->.*?', lambda match : ''), + (r'()
    .*?
', lambda match : match.group(1)), # drop story highlights + (r'

(.*?)

(.*?)

', lambda match : '

' + match.group(1) + '

' + match.group(2) + '

'), # sports uses h2 for main title and h1 for subtitle (???) switch these around + (r'.*?', lambda match : ''), # drop 'watch more' links + (r'(
).*?(||', lambda match : ''), # drop table formatting + (r'
.*?
', lambda match : ''), # drop extra business links + (r'.*?', lambda match : '') # drop business 'to top' link + ] ] + + def print_version(self, url): + return 'http://www.printthis.clickability.com/pt/printThis?clickMap=printThis&fb=Y&url=' + url + + def get_feeds(self): + return [ + ('Top News', 'http://rss.cnn.com/rss/cnn_topstories.rss'), + ('World', 'http://rss.cnn.com/rss/cnn_world.rss'), + ('U.S.', 'http://rss.cnn.com/rss/cnn_us.rss'), + ('Sports', 'http://rss.cnn.com/rss/si_topstories.rss'), + ('Business', 'http://rss.cnn.com/rss/money_latest.rss'), + ('Politics', 'http://rss.cnn.com/rss/cnn_allpolitics.rss'), + ('Law', 'http://rss.cnn.com/rss/cnn_law.rss'), + ('Technology', 'http://rss.cnn.com/rss/cnn_tech.rss'), + ('Science & Space', 'http://rss.cnn.com/rss/cnn_space.rss'), + ('Health', 'http://rss.cnn.com/rss/cnn_health.rss'), + ('Entertainment', 'http://rss.cnn.com/rss/cnn_showbiz.rss'), + ('Education', 'http://rss.cnn.com/rss/cnn_education.rss'), + ('Offbeat', 'http://rss.cnn.com/rss/cnn_offbeat.rss'), + ('Most Popular', 'http://rss.cnn.com/rss/cnn_mostpopular.rss') + ] diff --git a/src/libprs500/ebooks/lrf/web/profiles/dilbert.py b/src/libprs500/ebooks/lrf/web/profiles/dilbert.py new file mode 100644 index 0000000000..56025205bd --- /dev/null +++ b/src/libprs500/ebooks/lrf/web/profiles/dilbert.py @@ -0,0 +1,39 @@ +## Copyright (C) 2007 Kovid Goyal kovid@kovidgoyal.net +## Costomized to Dilbert by S. Dorscht and "Stenis" +## Version 0.02 +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License along +## with this program; if not, write to the Free Software Foundation, Inc., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + +''' +Fetch Dilbert. +''' + + +from libprs500.ebooks.lrf.web.profiles import DefaultProfile + +import re + +class Dilbert(DefaultProfile): + + title = 'Dilbert' + timefmt = ' [%d %b %Y]' + max_recursions = 1 + max_articles_per_feed = 6 + html_description = True + no_stylesheets = True + + def get_feeds(self): + return [ ('Dilbert', 'http://feeds.feedburner.com/tapestrydilbert') ] + diff --git a/src/libprs500/gui2/images.qrc b/src/libprs500/gui2/images.qrc index 4ea40a0dd0..c431f6a3bf 100644 --- a/src/libprs500/gui2/images.qrc +++ b/src/libprs500/gui2/images.qrc @@ -36,12 +36,14 @@ images/mimetypes/zip.svg images/news.svg images/news/bbc.png + images/news/cnn.png images/news/newsweek.png images/news/nytimes.png images/news/economist.png images/news/zeitde.png images/news/spiegelde.png images/news/faznet.png + images/news/dilbert.png images/next.svg images/page.svg images/plus.svg diff --git a/src/libprs500/gui2/images/news/cnn.png b/src/libprs500/gui2/images/news/cnn.png new file mode 100644 index 0000000000..1bcd6b0cb6 Binary files /dev/null and b/src/libprs500/gui2/images/news/cnn.png differ diff --git a/src/libprs500/gui2/images/news/dilbert.png b/src/libprs500/gui2/images/news/dilbert.png new file mode 100644 index 0000000000..d2f48423ab Binary files /dev/null and b/src/libprs500/gui2/images/news/dilbert.png differ