Skip to content

Commit

Permalink
Genshin Impact adapter fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ale183 authored Feb 9, 2023
2 parents 2365b66 + 35da09e commit f30a4cb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
name: Release ${{ github.ref }}
name: Release ${{ github.ref_name }}
body: New Moe Moe Secretary release
draft: false
prerelease: false
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ jobs:

env: # Or as an environment variable
BOT_TOKEN: ${{ secrets.DEPLOY_BOT_TOKEN }}
TARGET_CHAT_IDS: "[487353090, -1001342632426]"
# TARGET_CHAT_IDS: "[487353090, -1001342632426]"
TARGET_CHAT_IDS: "[487353090]"
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
ARTIFACT: "target/moe-moe-secretary.jar"

Expand Down
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.kitsunecode</groupId>
<artifactId>moe-moe-secretary</artifactId>
<version>1.2.2</version>
<version>1.2.3</version>
<packaging>jar</packaging>

<properties>
Expand All @@ -25,12 +25,12 @@
<maven-install-plugin.version>2.5.2</maven-install-plugin.version>
<maven-exec-plugin.version>1.6.0</maven-exec-plugin.version>

<gson.version>2.8.5</gson.version>
<gson.version>2.8.9</gson.version>
<vorbisspi.version>1.0.3.3</vorbisspi.version>
<jsoup.version>1.13.1</jsoup.version>
<commons-io.version>2.7</commons-io.version>
<snakeyaml.version>1.25</snakeyaml.version>
<httpclient.version>4.5.11</httpclient.version>
<jsoup.version>1.15.3</jsoup.version>
<commons-io.version>2.11.0</commons-io.version>
<snakeyaml.version>1.32</snakeyaml.version>
<httpclient.version>4.5.13</httpclient.version>
<tritonus.version>0.3.7-2</tritonus.version>
<mp3spi.version>1.9.5-1</mp3spi.version>
<vorbisspi.version>1.0.3-1</vorbisspi.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ public class GenshinImpact extends IWaifuAdapter {

private static final String BASE_URL = "https://genshin-impact.fandom.com";

private static final String IMAGES_SELECTOR = "a[title='Portrait'] img";
private static final String FEMALE_IMAGE_SELECTOR = "a[title='Female Portrait'] img";
private static final String MALE_IMAGE_SELECTOR = "a[title='Male Portrait'] img";
private static final String IMAGES_SELECTOR = "a[title='Wish'] img";
private static final String INGAME_IMAGE_SELECTOR = "a[title='In-Game'] img";
private static final String FEMALE_IMAGE_SELECTOR = "a[title='In-Game (Lumine)'] img";
private static final String MALE_IMAGE_SELECTOR = "a[title='In-Game (Aether)'] img";

public GenshinImpact(String name) {
super(name);
Expand All @@ -45,6 +46,7 @@ public void afterInit() {
private List<String> loadSkinUrls(Document mainDoc, Document outfitsDoc) {
List<String> urls = Stream.of(
Selector.select(IMAGES_SELECTOR, mainDoc).first(),
Selector.select(INGAME_IMAGE_SELECTOR, mainDoc).first(),
Selector.select(MALE_IMAGE_SELECTOR, mainDoc).first(),
Selector.select(FEMALE_IMAGE_SELECTOR, mainDoc).first()
).filter(Objects::nonNull)
Expand All @@ -62,13 +64,13 @@ private List<String> loadSkinUrls(Document mainDoc, Document outfitsDoc) {
String path = row.getElementsByTag("td").first().getElementsByTag("a").first().attr("href");
try {
Document outfitDoc = Jsoup.connect(BASE_URL + path).get();
Element portraitElement = Selector.select("a[title='Portrait']", outfitDoc).first();
Element portraitElement = Selector.select("a[title='Wish']", outfitDoc).first();
if (portraitElement != null) {
urls.add(portraitElement.attr("href").split("/revision")[0]);
}
Element previewElement = Selector.select("a[title='Preview']", outfitDoc).first();
if (previewElement != null) {
urls.add(previewElement.attr("href").split("/revision")[0]);
Element ingameElement = Selector.select("a[title='In-Game']", outfitDoc).first();
if (ingameElement != null) {
urls.add(ingameElement.attr("href").split("/revision")[0]);
}
} catch (IOException e) {
e.printStackTrace();
Expand All @@ -89,11 +91,14 @@ private List<Dialog> loadDialogs(Document document) {
.child(0)
.getElementsByTag("tr")
.stream()
.skip(1)
.skip(2)
.collect(Collectors.toList());

for (Element row : rows) {
Element td = row.getElementsByTag("td").first();
if(td == null) {
continue;
}
Element audioSpan = td.getElementsByTag("span").stream().findAny().orElse(null);
String audioUrl = null;
if (audioSpan != null) {
Expand Down

0 comments on commit f30a4cb

Please sign in to comment.