packages: pynapi/pynapi.py get_desc fixes

arekm arekm at pld-linux.org
Thu Apr 1 22:49:38 CEST 2010


Author: arekm                        Date: Thu Apr  1 20:49:38 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
get_desc fixes

---- Files affected:
packages/pynapi:
   pynapi.py (1.41 -> 1.42) 

---- Diffs:

================================================================
Index: packages/pynapi/pynapi.py
diff -u packages/pynapi/pynapi.py:1.41 packages/pynapi/pynapi.py:1.42
--- packages/pynapi/pynapi.py:1.41	Thu Apr  1 22:08:59 2010
+++ packages/pynapi/pynapi.py	Thu Apr  1 22:49:33 2010
@@ -73,7 +73,7 @@
 
 def get_desc_links(digest, file=None):
     # improve me
-    re_link = re.compile(r'<a.*?href=\'(http://.*?)\'>', re.IGNORECASE)
+    re_link = re.compile(r'<a.*?href=[\'"](http://.*?)[ >\'"]', re.IGNORECASE)
     d = ""
 
     try:
@@ -83,7 +83,16 @@
         f.close()
     except Exception, e:
         return False
-    return re_link.findall(d)
+    links = re_link.findall(d)
+    ignore = [ r'.*napiprojekt\.pl.*', r'.*nokaut\.pl.*', r'.*rodisite\.com.*' ]
+    for i in range(0, len(ignore)):
+        ignore[i] = re.compile(ignore[i], re.IGNORECASE)
+    ilinks = links[:]
+    for l in ilinks:
+        for i in ignore:
+            if i.match(l):
+                links.remove(l)
+    return links
 
 def get_cover(digest):
     cover = ""
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/pynapi/pynapi.py?r1=1.41&r2=1.42&f=u



More information about the pld-cvs-commit mailing list