Skip to content

Commit

Permalink
Merge pull request #13 from daktak/development
Browse files Browse the repository at this point in the history
update jsoup selectors
  • Loading branch information
daktak authored Sep 17, 2017
2 parents 77f5879 + 2886ec0 commit 3d9d76e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "org.afhdownloader"
minSdkVersion 16
targetSdkVersion 24
versionCode 7
versionName "0.4.2"
versionCode 8
versionName "0.4.3"
}
buildTypes {
release {
Expand Down
9 changes: 8 additions & 1 deletion app/src/main/java/org/afhdownloader/Download.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,18 @@ public String getBaseUrl() {
public String getMD5(String url) {
String md5S ="";
try {
Log.d(LOGTAG, "md5 url: "+url);
Document doc = Jsoup.connect(url).timeout(10 * 1000).get();
String select_md5 = "h4 + p > code";
/*
SharedPreferences mySharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
String select_md5 = mySharedPreferences.getString("prefSelector",getString(R.string.md5_sel_val)).trim();
*/
String select_md5 = "span:has(span:containsOwn(md5))";
Log.d(LOGTAG, "md5 selector: "+select_md5);
Elements md5s = doc.select(select_md5);
for (Element md5 : md5s) {
md5S = md5.ownText();
Log.d(LOGTAG, "md5 value: "+md5S);
}
} catch (Throwable t) {
Log.e(LOGTAG,t.getMessage());
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/donottranslate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<!-- <string name="urlext_val" translatable="false">?w=files&amp;flid=</string> -->
<string name="mirrorurl_val">https://www.androidfilehost.com/libs/otf/mirrors.otf.php</string>
<string name="mirrordata_val">submit=submit&amp;action=getdownloadmirrors&amp;</string>
<string name="selector_val" translatable="false">h4[class=list-group-item-heading] > i[class=fa fa-file-archive-o] + a[href^=/?fid=]</string>
<string name="selector_val" translatable="false">div[class=file-name] > h3 > a[href^=/?fid=]</string>
<string name="md5_sel_val" tranlatable="false">span:has(span:containsOwn(md5))</string>
<string name="base_val" translatable="false">https://www.androidfilehost.com</string>
<string name="flid_val" translatable="false">39788</string>
<string name="hour_val" translatable="false">3</string>
Expand Down

0 comments on commit 3d9d76e

Please sign in to comment.