Skip to content

Commit

Permalink
Fix explainxkcd extraction on 2408
Browse files Browse the repository at this point in the history
  • Loading branch information
zjn0505 committed May 17, 2022
1 parent ede76d8 commit fe4209c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/changelogs/75.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- Fix compatibility with Android 12
- Fix explainxkcd extraction on xkcd#2408

Full release note on https://is.gd/xkcd_app
1 change: 1 addition & 0 deletions fastlane/metadata/android/zh-CN/changelogs/75.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- 修复与 Android 12 的兼容性
- 修复 #2408 的 explainxkcd 提取

查看完整更新日志 https://is.gd/xkcd_app
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ object XkcdExplainUtil {
val doc = Jsoup.parse(responseBody.string())
doc.setBaseUri(url)

val h2Explain = doc.selectFirst("h2:has(span#Explanation)")
// https://explainxkcd.com/wiki/index.php/2408:_Egg_Strategies doesn't have Explanation span, good luck
val h2Explain = doc.selectFirst("h2:has(span#Explanation)") ?: doc.selectFirst("h2")
val nextH2Element = h2Explain.nextElementSiblings().select("h2").first()

val h2ExplainElementIndex = h2Explain.parent().childNodes().indexOf(h2Explain)
Expand Down

0 comments on commit fe4209c

Please sign in to comment.