Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 06-19-2009, 06:27 PM   #1
Reader2
intentionally left blank
Reader2 began at the beginning.
 
Reader2's Avatar
 
Posts: 28
Karma: 12
Join Date: Jun 2009
Location: Netherlands
Device: BeBook (display damage) so 2nd: Nook still working; Sony hardly used;
Volkskrant / Dutch news feed

For the dutch readers some code:

# -*- coding: utf-8 -*-
class AdvancedUserRecipe1245357002(BasicNewsRecipe):
title = u'Volkskrant'
oldest_article = 7
max_articles_per_feed = 100
no_stylesheets = True

feeds = [(u'laatstenieuws',u'http://feeds.volkskrant.nl/laatstenieuws/'),(u'nederland',u'http://feeds.volkskrant.nl/nederland/'),(u'economie',u'http://feeds.volkskrant.nl/economie/'),(u'kunst',u'http://feeds.volkskrant.nl/kunst/'),(u'wetenschap',u'http://feeds.feedburner.com/DeVolkskrantWetenschap/'),(u'techniek',u'http://feeds.feedburner.com/vkmedia/'),
]

remove_tags = [dict(name='div', attrs={'class':['mainItems','subItems','menuBarRight','zoek']}),dict(name='div', attrs={'id':['header','domeinenmenu','menuWrapper','zoek','prin tversie']})]
remove_tags_after = [dict(name='div', attrs={'class':'article_tools'})]

def print_version(self, url):
return url+'?service=Print'
# just for what it is, the "?service=Print" does not work - seems has to pass twice or someting like that - who can help me out?
Reader2 is offline   Reply With Quote
Old 06-20-2009, 04:51 PM   #2
kiklop74
Guru
kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.
 
kiklop74's Avatar
 
Posts: 800
Karma: 194644
Join Date: Dec 2007
Location: Argentina
Device: Kindle Voyage
Quote:
Originally Posted by Reader2 View Post
# just for what it is, the "?service=Print" does not work - seems has to pass twice or someting like that - who can help me out?
Your problem is that all rss feeds for that news site are feedburner which means that all url's to articles are aliases to the original url's on the site. That is why simple url replace does not work.

For example an url to the article located here:

Code:
http://www.volkskrant.nl/buitenland/article1246922.ece/Obama_Iran_moet_geweld_afzweren
Is presenter in the rss feed in the default tag "link" as this:

Code:
http://feeds.volkskrant.nl/~r/laatstenieuws/~3/rioZRPmRlxU/Obama_Iran_moet_geweld_afzweren
The original url is located in separate tag "feedburnerrigLink", however I do not know how to extract that. For this you will have to consult Kovid.

this is an example of how this might work:

Code:
class AdvancedUserRecipe1245529539(BasicNewsRecipe):
    title          = u'Volksran'
    oldest_article = 7
    max_articles_per_feed = 100

    feeds          = [(u'latest news', u'http://feeds.volkskrant.nl/laatstenieuws/')]

    def get_article_url(self, article):
        #this does not work
        artl =  article.get('feedburner:origLink', None)
        return artl

    def print_version(self, url):
        return url.replace('?source=rss','?service=Print')
kiklop74 is offline   Reply With Quote
Advert
Old 06-20-2009, 10:43 PM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Here's what you need

Code:
 def get_article_url(self, article):
        return article.get('feedburner_origlink', article.get('guid', article.get('link')))
kovidgoyal is offline   Reply With Quote
Old 06-22-2009, 01:43 PM   #4
Reader2
intentionally left blank
Reader2 began at the beginning.
 
Reader2's Avatar
 
Posts: 28
Karma: 12
Join Date: Jun 2009
Location: Netherlands
Device: BeBook (display damage) so 2nd: Nook still working; Sony hardly used;
THX again. I just gave it a try - and did manage it on the dirty way. Thx for the "feedburner" hint, this will do for more sites.
Mmm, what an active forum this is. Great
Reader2 is offline   Reply With Quote
Old 09-04-2009, 03:22 PM   #5
Reader2
intentionally left blank
Reader2 began at the beginning.
 
Reader2's Avatar
 
Posts: 28
Karma: 12
Join Date: Jun 2009
Location: Netherlands
Device: BeBook (display damage) so 2nd: Nook still working; Sony hardly used;
Great, its now included as Dutch feed.
Reader2 is offline   Reply With Quote
Advert
Reply

Tags
custom news source, nederlands


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Two different formats on news feed TonytheBookworm Calibre 3 10-06-2010 11:51 AM
News Feed Covers DenverReader Calibre 4 02-06-2010 12:00 AM
News feed scheduling nickredding Calibre 1 01-24-2010 07:28 PM
News feed error thibaulthalpern Calibre 4 03-22-2009 02:21 AM
Need help creating a news feed ficbot Calibre 3 03-18-2009 02:44 AM


All times are GMT -4. The time now is 06:41 PM.


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