Fix some IDs and update utils
authorNiki Roo <niki@nikiroo.be>
Fri, 7 Sep 2018 06:51:27 +0000 (08:51 +0200)
committerNiki Roo <niki@nikiroo.be>
Fri, 7 Sep 2018 06:51:27 +0000 (08:51 +0200)
libs/nikiroo-utils-4.4.0-sources.jar [moved from libs/nikiroo-utils-4.2.1-sources.jar with 76% similarity]
src/be/nikiroo/gofetch/support/LWN.java
src/be/nikiroo/gofetch/support/Phoronix.java
src/be/nikiroo/gofetch/support/Slashdot.java
src/be/nikiroo/gofetch/support/TooLinux.java

similarity index 76%
rename from libs/nikiroo-utils-4.2.1-sources.jar
rename to libs/nikiroo-utils-4.4.0-sources.jar
index f93beca4e36e9e64be80f6d3cbe75aef03ffe943..63f158ee48f9e6193e25703c056f6f3409d08f2b 100644 (file)
Binary files a/libs/nikiroo-utils-4.2.1-sources.jar and b/libs/nikiroo-utils-4.4.0-sources.jar differ
index 144fdc90514039656168bf41fef8b850a027d4fe..eac12e5c239c37aa921d2945333d1b7fbc4c4e9a 100644 (file)
@@ -53,7 +53,12 @@ public class LWN extends BasicSupport {
 
        @Override
        protected String getArticleId(Document doc, Element article) {
-               return getArticleIntUrl(doc, article).replaceAll("[^0-9]", "");
+               String id = getArticleIntUrl(doc, article).replaceAll("[^0-9]", "");
+               while (id.length() < 10) {
+                       id = "0" + id;
+               }
+
+               return id;
        }
 
        @Override
index 8f257fbb0d7b3a36d17a8601a61fc3bfd3de6149..5338cd639ff2ebe2435834336af1232320827ebf 100644 (file)
@@ -45,6 +45,9 @@ class Phoronix extends BasicSupport {
                                        id = id.substring(pos + 1);
                                }
 
+                               while (id.length() < 10) {
+                                       id = "0" + id;
+                               }
                                return id;
                        }
                }
index 43ce13d023ff498d3a759e9eac884f351d10e79a..6fb51a6dd32cb5f0bd37692165560ca1fdb915b9 100644 (file)
@@ -45,6 +45,10 @@ public class Slashdot extends BasicSupport {
                                id = id.substring("title-".length());
                        }
 
+                       while (id.length() < 10) {
+                               id = "0" + id;
+                       }
+
                        return id;
                }
 
index ba909cfdc63fa60b8fdae0beba04efa0e709c075..77f0c30fbf63db414c11778b6a40c44fc464cd98 100644 (file)
@@ -60,7 +60,7 @@ public class TooLinux extends BasicSupport {
        protected String getArticleDate(Document doc, Element article) {
                Element dateElement = article.getElementsByClass("published").first();
                if (dateElement != null) {
-                       return dateElement.text();
+                       return dateElement.attr("title");
                }
 
                return "";