[Debian-l10n-devel] Adding DDTSS-related services to l10n.debian.org
s3v
c0llapsed at yahoo.it
Fri Sep 23 11:35:38 UTC 2016
Hi,
> I created a repo [1] on Alioth and just pushed to it. As I am a total
> noob in Python, comments are very welcome. :)
my skills in Python are limited but I think that BeautifulSoup could be avoided by
employing "re" built-in module instead.
Stat pages by letter are very useful and their layout looks great! I hope this
script will get into l10n project ecosystem ;)
Patch below have been tested only for italian package list.
--- ddtss-numbers.py 2016-09-23 13:34:14.783617900 +0200
+++ ddtss-numbers2.py 2016-09-23 13:34:20.027554123 +0200
@@ -2,3 +1,0 @@
-#
-# Dependencies :
-# - python-bs4
@@ -6 +2,0 @@
-from bs4 import BeautifulSoup
@@ -14,0 +11 @@
+import re
@@ -34 +30,0 @@
- soup = BeautifulSoup(page)
@@ -40 +36 @@
- soup_all_packs = soup.find_all('pre')[0].contents
+ soup_all_packs = re.findall("<a href=\"ddt\.cgi.*>(.*)<\/a>(.*)", page, re.M)
@@ -45 +41 @@
- for n in range (1, len(soup_all_packs), 2):
+ for n in range (len(soup_all_packs)):
@@ -47 +43 @@
- name = soup_all_packs[n-1].contents[0]
+ name = soup_all_packs[n][0]
@@ -60 +56 @@
- if (soup_all_packs[n] == " untranslated\n"):
+ if (soup_all_packs[n][1] == " untranslated"):
Many thanks for your work.
Regards.
More information about the Debian-l10n-devel
mailing list