09-22-2010, 12:00 PM | #2806 | |
Addict
Posts: 264
Karma: 62
Join Date: May 2010
Device: kindle 2, kindle 3, Kindle fire
|
Quote:
Spoiler:
|
|
09-22-2010, 12:08 PM | #2807 | ||
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
Code:
no_stylesheets = True or def preprocess_html(self, soup): for item in soup.findAll(style=True): del item['style'] return soup Quote:
I suck at CSS, too, but I get by, and most of what I've learned has come from others who do more format conversions than I do. Last edited by Starson17; 09-22-2010 at 12:13 PM. |
||
Advert | |
|
09-22-2010, 12:19 PM | #2808 | ||
Junior Member
Posts: 2
Karma: 10
Join Date: Sep 2010
Device: Kindle 3G
|
Hi Starson17,
thanks for your reply. Quote:
Quote:
|
||
09-22-2010, 12:36 PM | #2809 | ||
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
Quote:
|
||
09-22-2010, 12:37 PM | #2810 |
Addict
Posts: 264
Karma: 62
Join Date: May 2010
Device: kindle 2, kindle 3, Kindle fire
|
Starson17,
Do you mind looking at this when you get a sec and telling me what the heck I'm doing wrong as far as the css is concerned please? What my objective is, is to change this Code:
Egypts housing market recovers! So based on what I have gathered from other recipes and from you my code "should reformat it", but it doesn't. Spoiler:
|
Advert | |
|
09-22-2010, 01:27 PM | #2811 | |
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
2) It has inline style on your header. Strip that first: Code:
def preprocess_html(self, soup): for item in soup.findAll(attrs={'style':True}): del item['style'] return soup Spoiler:
Edit: (I made the header red to spot the change easily.) Last edited by Starson17; 09-22-2010 at 01:37 PM. |
|
09-22-2010, 01:42 PM | #2812 |
Junior Member
Posts: 7
Karma: 10
Join Date: Sep 2010
Location: USA
Device: Kindle
|
Recipe Request
I would like to request a recipe for the "Current Issue" of Science News.
The rss feed is: http://www.sciencenews.org/view/feed...ame/issues.rss I know that a Science News recipe exists, but simply switching the feeds does not return articles for the "current issue" |
09-22-2010, 01:55 PM | #2813 | |
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
Are you looking for one issue and its articles, or all the issues in that feed and all the articles in them? It looks interesting, so I may tackle it. |
|
09-22-2010, 02:02 PM | #2814 |
Member
Posts: 19
Karma: 10
Join Date: Feb 2010
Location: Los Angeles, CA
Device: Kindle 3
|
@Starson17
I've modified your recipe, made a few blog additions, etc. and created a daily blog roll recipe. Only problem is, it looks like the extra_css properties are not being applied. If I: Code:
ebook-convert my.recipe output && grep -ir "astyle" output/ I tried a few things like simplifying the extra_css and removing the no_stylesheets. The modified recipe looks like: Code:
# vim:ft=python __license__ = 'GPL v3' __copyright__ = '2010, James Kyle <james at jameskyle dot org>' """ Daily Blog Roll """ from calibre.web.feeds.recipes import BasicNewsRecipe import re class DailyBlogs(BasicNewsRecipe): title = u'Daily Blog Roll' description = "Collection of Daily Blog Reading" oldest_article = 1 max_articles_per_feed = 5 added_links = [] remove_tags = [ dict(name='a', attrs={ 'class':'a2a_dd addtoany_share_save'}), dict(name='div', attrs={ 'class':['Introduction','divider']}), dict(name='div', attrs={ 'id':['feature', 'podcast']}), dict(name='div', attrs={ 'id':re.compile(r'follow.*', re.DOTALL|re.IGNORECASE)}), dict(name='hr'), ] language = 'en' remove_empty_feeds = True remove_javascript = True no_stylesheets = True extra_css = """ h1 { font-family:Arial,Helvetica,sans-serif; font-weight:bold; font-size:large; } h2 { font-family:Arial,Helvetica,sans-serif; font-weight:normal; font-size: 2.6em; } p { font-family:Arial,Helvetica,sans-serif; font-size:small; } body { font-family:Helvetica,Arial,sans-serif; font-size:small; } """ feeds = [ (u'Weird Things', u'feed://worldofweirdthings.com/feed/'), (u'Bad Astronomy', u'feed://feeds.feedburner.com/BadAstronomyBlog?format=xml'), (u'Skepticblog', u'feed://skepticblog.org/feed/'), (u'The Skeptic', u'http://www.skeptic.com/feed'), (u'E-Skeptic', u'http://www.skeptic.com/eskeptic'), (u'All-SkepticBlog', u'http://skepticblog.org/feed'), (u'Brian Dunning', u'http://skepticblog.org/author/dunning/feed/'), (u'Daniel Loxton', u'http://skepticblog.org/author/loxton/feed/'), (u'Kirsten Sanford', u'http://skepticblog.org/author/sanford/feed/'), (u'Mark Edward', u'http://skepticblog.org/author/edward/feed/'), (u'Michael Shermer', u'http://skepticblog.org/author/shermer/feed/'), (u'Phil Plait', u'http://skepticblog.org/author/plait/feed/'), (u'Ryan Johnson', u'http://skepticblog.org/author/johnson/feed/'), (u'Steven Novella', u'http://skepticblog.org/author/novella/feed/'), (u'Yau-Man Chan', u'http://skepticblog.org/author/chan/feed/'), ] cover_url = "http://skepticblog.org/wp-content/uploads/Fairy_making_of_15_S.jpg" def get_browser(self): br = BasicNewsRecipe.get_browser(self) br.addheaders = [('Accept', 'text/html')] return br |
09-22-2010, 02:25 PM | #2815 | |
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
You need indents in the extra_css, just like elsewhere, or they'll get ignored. |
|
09-22-2010, 02:27 PM | #2816 | |
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
Spoiler:
|
|
09-22-2010, 02:32 PM | #2817 | |
Junior Member
Posts: 7
Karma: 10
Join Date: Sep 2010
Location: USA
Device: Kindle
|
Quote:
Hope you take on the task, and thank you for your interest! - Teddy |
|
09-22-2010, 02:41 PM | #2818 |
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
A first draft is already posted - the ball's in your court now. (It's currently multiple issues, not single issue, but that's not hard to fix later, once the format is cleaned up.)
|
09-22-2010, 02:42 PM | #2819 |
Junior Member
Posts: 7
Karma: 10
Join Date: Sep 2010
Location: USA
Device: Kindle
|
Ha! yeah so in the time it took me to respond to you you've already made a first draft.
attempting to download right now. Seems to be working. |
09-22-2010, 03:00 PM | #2820 | |
Junior Member
Posts: 7
Karma: 10
Join Date: Sep 2010
Location: USA
Device: Kindle
|
Quote:
I love Science News too! Thank you for your time and effort in making this recipe work. It will add tons of enjoyment to my life! umm.. and knowledge. will increase my knowledge of science stuff :-) |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Custom column read ? | pchrist7 | Calibre | 2 | 10-04-2010 02:52 AM |
Archive for custom screensavers | sleeplessdave | Amazon Kindle | 1 | 07-07-2010 12:33 PM |
How to back up preferences and custom recipes? | greenapple | Calibre | 3 | 03-29-2010 05:08 AM |
Donations for Custom Recipes | ddavtian | Calibre | 5 | 01-23-2010 04:54 PM |
Help understanding custom recipes | andersent | Calibre | 0 | 12-17-2009 02:37 PM |