View Single Post
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