View Single Post
Old 02-08-2010, 03:32 PM   #1394
jackietreehorn
Junior Member
jackietreehorn began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Feb 2010
Device: Android/ G1
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:

1- Could not fetch link http://www.radikal.com.tr/Default.aspx?aType=HaberYazdir&Ar
ticleID=979148

Traceback (most recent call last):
File "site-packages\calibre\web\fetch\simple.py", line 442, in process_links
File "site-packages\calibre\web\feeds\news.py", line 599, in _postprocess_html
AttributeError: 'NoneType' object has no attribute 'insert'
http://www.radikal.com.tr/Default.as...ticleID=979148 saved
to c:\docume~1\engin\locals~1\temp\calibre_0.6.37_nba ozi_plumber\feed_0\article_
3\Default.xhtml

There is a created issue for this "AttributeError" (http://bugs.calibre-ebook.com/ticket/1270). However, my page does not have the DOCTYPE issue. I do however get validation errors if I try to validate the page.


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.

3- On some pages I get " Exception: Could not fetch article. Run with -vv to see the reason", even though I have the "-vv" option. How do I set the debug mode on?

Last edited by jackietreehorn; 02-08-2010 at 05:47 PM.
jackietreehorn is offline