X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Fgofetch%2Fsupport%2FLWN.java;h=37a5a8f2fefcf8a88b71228e3ee62db01b88a86a;hb=b34d1f357b076c1697e381b70cb6ff1bb0278b91;hp=27b539c5e42ffa6bec08c5c4e689377bf3742068;hpb=136ab80122a17caa0720116d6d2552521239fbb3;p=gofetch.git diff --git a/src/be/nikiroo/gofetch/support/LWN.java b/src/be/nikiroo/gofetch/support/LWN.java index 27b539c..37a5a8f 100644 --- a/src/be/nikiroo/gofetch/support/LWN.java +++ b/src/be/nikiroo/gofetch/support/LWN.java @@ -59,8 +59,16 @@ public class LWN extends BasicSupport { } body = body.trim(); + int pos; + + String categ = ""; + pos = details.indexOf("]"); + if (pos >= 0) { + categ = details.substring(1, pos + 1).trim(); + } + String author = ""; - int pos = details.indexOf(" by "); + pos = details.indexOf(" by "); if (pos >= 0) { author = details.substring(pos + " by ".length()).trim(); } @@ -69,8 +77,15 @@ public class LWN extends BasicSupport { pos = details.indexOf(" Posted "); if (pos >= 0) { date = details.substring(pos + " Posted ".length()).trim(); + pos = details.indexOf(" by "); + if (pos >= 0) { + author = details.substring(0, pos).trim(); + } } + // We extracted everything from details so... + details = ""; + String id = ""; String intUrl = ""; String extUrl = ""; @@ -84,8 +99,8 @@ public class LWN extends BasicSupport { id = intUrl.replaceAll("[^0-9]", ""); } - list.add(new Story(getType(), id, title, details, intUrl, extUrl, - body)); + list.add(new Story(getType(), id, title, author, date, categ, + details, intUrl, extUrl, body)); } return list;