View Single Post
Old 02-08-2010, 08:17 PM   #1395
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,897
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
Quote:
Originally Posted by jackietreehorn View Post
I am trying to create a custom recipe for the Turkish newspaper site Radikal. Here is my code:

Code:
class AdvancedUserRecipe1265645305(BasicNewsRecipe):
    title          = u'Radikal'
    language = 'tr'
    oldest_article = 5
    max_articles_per_feed = 5
    cover_url = 'http://www.radikal.com.tr/D/i/1/V2/radikal_logo.jpg'
    feeds          = [(u'Yazarlar', u'http://www.radikal.com.tr/d/rss/RssYazarlar.xml')]

    def print_version(self, url):
      return url.replace('aType=RadikalYazarYazisi', 'aType=HaberYazdir')
I use the following command: "ebook-convert radikal.recipe output -vv". The folder "output" is created, however I get bunch of errors and my created index.html is almost empty. I have the following issues:



2- print_version function does not work for all the URLs. For instance:
- 7% Article download failed: u'\u0130\u015fsiz aileye ayda 300 lira'
Failed to download article: ... http://www.radikal.com.tr/Default.aspx?aType=RadikalYazarYazisi&ArticleID=979171

I would expect "RadikalYazarYazisi" to be replaced with "HaberYazdir" here.

I can't help with 1 or 3 and I am not versed in all of the ways of getting the print page but I am relatively sure the below code will work.

Code:
    def print_version(self, url):
        return url.replace('http://www.radikal.com.tr/Default.aspx?aType=HaberYazdir', 'http://www.radikal.com.tr/Default.aspx?aType=RadikalYazarYazisi')
DoctorOhh is offline