Reset unused cids, refactoring

This commit is contained in:
M66B
2019-01-06 10:15:06 +00:00
parent 53de71bccb
commit ae1a36b482
7 changed files with 88 additions and 81 deletions

View File

@@ -43,6 +43,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@@ -288,4 +289,16 @@ public class HtmlHelper {
return sb.toString();
}
static List<String> getCids(String html) {
List<String> result = new ArrayList<>();
for (Element element : Jsoup.parse(html).select("img")) {
String src = element.attr("src");
if (src.startsWith("cid:"))
result.add("<" + src.substring(4) + ">");
}
return result;
}
}