Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 04-06-2012, 10:32 AM   #1
cram1010
Member
cram1010 began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Apr 2012
Device: Bq cervantes
Error "Could not fetch link..." while creating a basic recipe

Hi,

I'm trying to create a very simple recipe for the site http://www.rebelion.org

I'm trying to just feed from one RSS source: http://rebelion.org/rss_portada.php

I don't know why, it's not working. For each article it tries to download, following error like this one is given:

Fetching http://www.rebelion.org/noticias/ame...olonial-147596
Traceback (most recent call last):
File "/usr/lib/calibre/calibre/utils/threadpool.py", line 95, in run
(request, request.callable(*request.args, **request.kwds))
File "/usr/lib/calibre/calibre/web/feeds/news.py", line 811, in fetch_article
return self._fetch_article(url, dir, f, a, num_of_feeds)
File "/usr/lib/calibre/calibre/web/feeds/news.py", line 807, in _fetch_article
raise Exception(_('Could not fetch article. Run with -vv to see the reason'))
Exception: Could not fetch article. Run with -vv to see the reason


I attach two files. The recipe one and the full output I receive when trying to create with -vv. Format is txt to allow uploading.

Thank you!
Attached Files
File Type: txt rebelion.recipe.txt (1.0 KB, 279 views)
File Type: txt output.txt (99.7 KB, 278 views)
cram1010 is offline   Reply With Quote
Old 05-03-2012, 07:18 PM   #2
atlantique
Junior Member
atlantique began at the beginning.
 
Posts: 4
Karma: 10
Join Date: May 2010
Device: kindle dx
The typical format of an url included in one of the rebelion.org rss feeds looks like this:

http://www.rebelion.org/noticias/ee....nicomio-148960

In order to avoid the 404 "Not found" problem, it is necessary to convert the URL
to the following format:

http://www.rebelion.org/noticia.php?...-al-manicomio-

Doing this for each of the url listed on the rss feed will solve your problem. However
I do not know how to do this using calibre/python regular expressions, although
one can presume that it must simple to do it, since it is rather straightforward
using set/awk.

Let us hope that one of the more knowledgeable users will help with this url
modification. Good luck!
atlantique is offline   Reply With Quote
Advert
Old 05-04-2012, 11:13 AM   #3
cram1010
Member
cram1010 began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Apr 2012
Device: Bq cervantes
Thanks a lot atlantique. With your tip I got to build the rebelion.org recipe. I have posted it here: https://www.mobileread.com/forums/sho....php?p=2068864

Anyway it's strange, why 404 code is returned if the url do exist?

I explain how I solved the issue:

In fact, I realized the ' titular' parameter is no needed, and correct url can simply be:

http://www.rebelion.org/noticia.php?id=148960

As the id is the last sequence of digits of the incorrect url, we can do:

Code:
import re #import regexp module
class RebelionRecipe (BasicNewsRecipe):
  #[...Some code...]
  def print_version(self, url):
     id = re.compile('\d*$').search(url).group() #'\d*$' matches 'last serie of digits in a string', which we search in the url. group() returns matched string, which is the id
     return u'http://www.rebelion.org/noticia.php?id=%s' % id
cram1010 is offline   Reply With Quote
Old 05-05-2012, 06:15 AM   #4
vietchovui
Zealot
vietchovui will become famous soon enoughvietchovui will become famous soon enoughvietchovui will become famous soon enoughvietchovui will become famous soon enoughvietchovui will become famous soon enoughvietchovui will become famous soon enough
 
Posts: 109
Karma: 556
Join Date: Nov 2009
Location: SaiGon VietNam
Device: PRS T1, Kobo Forma 8G, Kobo Libra H2O
I have prob with this feed: http://tuanvietnam.net/home/rss
The article title in the feed is something like this http://tuanvietnam.vietnamnet.vn/XYZ
but the actual article link is http://tuanvietnam.net/XYZ. So, what can I do to make calibre work with this feed?
Added: I have read about replace/join code in the thread Recipes - Re-usable code. But I still cannot fix this prob myself. I'm completely noob in programming.
Attached Files
File Type: txt cailbre - TuanVietNam_25.recipe.txt (245 Bytes, 243 views)

Last edited by vietchovui; 05-05-2012 at 11:26 AM. Reason: find out the bug
vietchovui is offline   Reply With Quote
Old 05-05-2012, 07:13 AM   #5
vietchovui
Zealot
vietchovui will become famous soon enoughvietchovui will become famous soon enoughvietchovui will become famous soon enoughvietchovui will become famous soon enoughvietchovui will become famous soon enoughvietchovui will become famous soon enough
 
Posts: 109
Karma: 556
Join Date: Nov 2009
Location: SaiGon VietNam
Device: PRS T1, Kobo Forma 8G, Kobo Libra H2O
[deleted] please read the above post.

Last edited by vietchovui; 05-05-2012 at 11:28 AM.
vietchovui is offline   Reply With Quote
Advert
Reply

Tags
error, error message, recipes


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
"ELF binary type "0" not known" Error. When run Kindlegen chovan Amazon Kindle 4 02-09-2012 11:49 AM
"Error" instead of "Reader" in source pane Mad_Max Sony Reader 19 07-16-2011 10:47 PM
Touch "Updating Reading Life" = "Network error" m_bisson Kobo Reader 5 07-15-2011 01:05 AM
Creator taking control of the "first page" link in the "content" menu cyberbaffled Kindle Formats 2 07-11-2010 04:21 PM
Feature Request - cover browse in the "Fetch Metadata from server" function nathander13 Calibre 1 01-30-2010 02:11 PM


All times are GMT -4. The time now is 08:04 PM.


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