Skip to content

Commit

Permalink
Fixed forvo audio
Browse files Browse the repository at this point in the history
  • Loading branch information
KamWithK committed Jul 28, 2022
1 parent b60818f commit 983788e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {
applicationId "com.kamwithk.ankiconnectandroid"
minSdk 21
targetSdk 32
versionCode 5
versionCode 6
versionName "1.4"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ public ArrayList<HashMap<String, String>> scrape(String word, String reading) th

private ArrayList<HashMap<String, String>> scrapeWord(String word) throws IOException {
Document document = Jsoup.connect(SERVER_HOST + "/word/" + strip(word) + "/").get();
Elements elements = document.select("#language-container-" + LANGUAGE + ">article>ul.show-all-pronunciations>li:not(.li-ad)");
Elements elements = document.select("#language-container-" + LANGUAGE + ">article>ul>li:not(.li-ad)");

ArrayList<HashMap<String, String>> audio_sources = new ArrayList<>();

for (Element element : elements) {
String url = extractURL(Objects.requireNonNull(element.selectFirst("span")));
System.out.println(element);
String url = extractURL(Objects.requireNonNull(element.selectFirst(".play")));

HashMap<String, String> user_details = new HashMap<>();
user_details.put("name", "Forvo (" + extractUsername(element.text()) + ")");
Expand All @@ -57,7 +58,7 @@ private ArrayList<HashMap<String, String>> scrapeWord(String word) throws IOExce

private ArrayList<HashMap<String, String>> scrapeSearch(String input) throws IOException {
Document document = Jsoup.connect(SERVER_HOST + "/search/" + strip(input) + "/" + LANGUAGE + "/").get();
Elements elements = document.select("ul.word-play-list-icon-size-l>li>span.play");
Elements elements = document.select("ul.word-play-list-icon-size-l>li>.play");

ArrayList<HashMap<String, String>> audio_sources = new ArrayList<>();

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.0"
classpath 'com.android.tools.build:gradle:7.2.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Feb 09 16:34:13 AEDT 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

0 comments on commit 983788e

Please sign in to comment.