Skip to content

Commit 1beaece

Browse files
author
caodongping
committed
fix issue-226 parse problem
1 parent ae6dd04 commit 1beaece

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

app/src/main/java/com/github/mzule/androidweekly/api/parser/FresherArticlesParser.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ public List<Object> parse(String issue) throws IOException {
2323
String currentSection = null;
2424
for (Element e : tables) {
2525
Elements h2 = e.getElementsByTag("h2");
26-
if (!h2.isEmpty()) {
27-
currentSection = h2.get(0).text();
28-
articles.add(currentSection);
26+
Elements h5 = e.getElementsByTag("h5");// 兼容issue-226 SPONSORED 在 h5 标签里面
27+
if (!h2.isEmpty() || !h5.isEmpty()) {
28+
currentSection = h2.size() > 0 ? h2.get(0).text() : h5.get(0).text();
29+
if (!articles.contains(currentSection)) {
30+
articles.add(currentSection);
31+
}
2932
} else {
3033
Elements tds = e.getElementsByTag("td");
3134
Element td = tds.get(tds.size() - 2);

0 commit comments

Comments
 (0)