Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 09-25-2010, 01:31 PM   #1
ramesses
Junior Member
ramesses began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Sep 2010
Device: Kindle 3
Post iDnes.cz news

Hi,
I was trying to do a recipe for iDnes.cz news (RSS: http://servis.idnes.cz/rss.asp?c=zpravodaj) but I stuck with print_version.
I didn't find any similiar rss source to this one. I would appriciate help with converting article url.

example article url:
http://zpravy.idnes.cz/pojd-s-nami-k...1427_krimi_zep

its coresponding printable version url:
http://zpravy.idnes.cz/tiskni.asp?c=...1427_krimi_zep

Thank you for any little help.
ramesses is offline   Reply With Quote
Old 09-25-2010, 01:40 PM   #2
TonytheBookworm
Addict
TonytheBookworm is on a distinguished road
 
TonytheBookworm's Avatar
 
Posts: 264
Karma: 62
Join Date: May 2010
Device: kindle 2, kindle 3, Kindle fire
Quote:
Originally Posted by ramesses View Post
Hi,
I was trying to do a recipe for iDnes.cz news (RSS: http://servis.idnes.cz/rss.asp?c=zpravodaj) but I stuck with print_version.
I didn't find any similiar rss source to this one. I would appriciate help with converting article url.

example article url:
http://zpravy.idnes.cz/pojd-s-nami-k...1427_krimi_zep

its coresponding printable version url:
http://zpravy.idnes.cz/tiskni.asp?c=...1427_krimi_zep

Thank you for any little help.
post your code here and i will try to help you out. take and wrap it in spoiler tags and code tags. change the " to a [
example:
"spoiler"
"code'
paste your recipe code here
"/code"
"/spoiler"

here is a general idea of how to convert the print_version

You state the original url is:
and the printversion is:
So what the only thing you need from the original url is everything after the ? mark
In that case you simply can split the url at the ? and then it will be in two parts
u'http://xxxxxxxxxxxxxxxxxxxxxx' u'c=A100925_171427_krimi_zep'

the split will be 0 based so we want the index of 1
see below:

Code:
def print_version(self, url):
        split_url = url.split("?")
        print_url = 'http://zpravy.idnes.cz/tiskni.asp? ' +  split_url[1] '
        return print_url

Last edited by TonytheBookworm; 09-25-2010 at 01:53 PM. Reason: added example
TonytheBookworm is offline   Reply With Quote
 
Enthusiast
Old 09-25-2010, 03:37 PM   #3
ramesses
Junior Member
ramesses began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Sep 2010
Device: Kindle 3
Thank you very much. Your print_version is exactly what I needed to move on.
Here is my actual working code:
Spoiler:
Code:
class AdvancedUserRecipe1285425351(BasicNewsRecipe):
    __license__  = 'GPL v3'
    __author__  = 'Radim Pešek'
    title = u'iDnes.cz'
    publisher = u'MAFRA a.s.'
    description = 'Zprávy iDNES.cz - přehled nejnovějších událostí z domova i ze světa'
    oldest_article = 7
    max_articles_per_feed = 100
    encoding = 'cp1250'
    language = 'cs'
    cover_url = 'http://g.idnes.cz/u/loga-n4/idnes.gif'
    remove_javascript = True
    remove_tags = [dict(name='div', attrs={'class':['related', 'authors','back ico','fl','fc0','ico art-add']})]

    def print_version(self, url):
        split_url = url.split("?")
        print_url = 'http://zpravy.idnes.cz/tiskni.asp?' +  split_url[1]
        return print_url

    feeds = [(u'Z domova i ze sveta', u' http://servis.idnes.cz/rss.asp?c=zpravodaj')]

Please, can you help me how to fix bad diacritics in Section List and Article List on my Kindle (articles have correct diacritics). The website uses cp1250 encoding.
ramesses is offline   Reply With Quote
Old 09-25-2010, 03:45 PM   #4
TonytheBookworm
Addict
TonytheBookworm is on a distinguished road
 
TonytheBookworm's Avatar
 
Posts: 264
Karma: 62
Join Date: May 2010
Device: kindle 2, kindle 3, Kindle fire
Quote:
Originally Posted by ramesses View Post
Thank you very much. Your print_version is exactly what I needed to move on.
Here is my actual working code:

Please, can you help me how to fix bad diacritics in Section List and Article List on my Kindle (articles have correct diacritics). The website uses cp1250 encoding.
As far as encoding issues from other languages, I really can't help with that. Maybe someone else can help you with that issue.
TonytheBookworm is offline   Reply With Quote
Old 09-25-2010, 04:02 PM   #5
ramesses
Junior Member
ramesses began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Sep 2010
Device: Kindle 3
ok, thanks.
I hope someone write according the encoding issue.
ramesses is offline   Reply With Quote
Old 09-25-2010, 05:38 PM   #6
ramesses
Junior Member
ramesses began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Sep 2010
Device: Kindle 3
I found more information about the encoding issue here. It seems to be maybe Calibre bug.
ramesses is offline   Reply With Quote
Old 10-05-2010, 03:18 PM   #7
ramesses
Junior Member
ramesses began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Sep 2010
Device: Kindle 3
New Calibre version 0.7.22 fixed the encoding issue in Section List and Article List. Thank you!
ramesses is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add only news tag to downloaded news? eric11210 Calibre 2 08-06-2010 05:51 AM
Old news but good news PsyDocJoanne Reading Recommendations 31 10-29-2008 07:05 AM
Bad news, good news, and a question MSWallack Sony Reader 3 07-15-2008 03:25 PM
AP News Begins Charging Web News Providers Bob Russell Lounge 1 04-20-2005 10:38 AM


All times are GMT -4. The time now is 10:34 AM.


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