From f9f0bc26b092d9162a20e5bedad4c35301724e5c Mon Sep 17 00:00:00 2001 From: Florent Date: Mon, 4 Feb 2013 13:03:26 +0100 Subject: [PATCH] Get real ID directly with url2id --- modules/presseurop/tools.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/presseurop/tools.py b/modules/presseurop/tools.py index 322c3d92..b30a3c16 100644 --- a/modules/presseurop/tools.py +++ b/modules/presseurop/tools.py @@ -23,13 +23,13 @@ import re def url2id(url): "return an id from an url" - regexp = re.compile(".*/([0-9]+)-.*") - id = regexp.match(url).group(1) - return id + if "/today/" in entry.link: + return link.split("#")[1] + else: + regexp = re.compile(".*/([0-9]+)-.*") + id = regexp.match(url).group(1) + return id def rssid(entry): - if "/today/" in entry.link: - return entry.link.split("#")[1] - else: - return url2id(entry.link) + return url2id(entry.link)