diff --git a/app/src/main/java/org/afhdownloader/Download.java b/app/src/main/java/org/afhdownloader/Download.java index 2b15a0c..bb1c026 100644 --- a/app/src/main/java/org/afhdownloader/Download.java +++ b/app/src/main/java/org/afhdownloader/Download.java @@ -84,8 +84,8 @@ public String parseUrl(String url) { Log.d(LOGTAG, "Fetch: "+url); ArrayList urls = new ArrayList(); try { - - Document doc = Jsoup.connect(url).timeout(10*1000).get(); + String userAgent = getString(R.string.user_agent); + Document doc = Jsoup.connect(url).timeout(10*1000).followRedirects(true).userAgent(userAgent).get(); SharedPreferences mySharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); String selector = mySharedPreferences.getString("prefSelector",getString(R.string.selector_val)).trim(); //String selector = getString(R.string.selector_val); @@ -135,7 +135,8 @@ public String getMD5(String url) { String md5S =""; try { Log.d(LOGTAG, "md5 url: "+url); - Document doc = Jsoup.connect(url).timeout(10 * 1000).get(); + String userAgent = getString(R.string.user_agent); + Document doc = Jsoup.connect(url).timeout(10 * 1000).followRedirects(true).userAgent(userAgent).get(); /* SharedPreferences mySharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); String select_md5 = mySharedPreferences.getString("prefSelector",getString(R.string.md5_sel_val)).trim(); @@ -157,6 +158,7 @@ public ArrayList getDLUrl(String url){ SharedPreferences mySharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); String data = mySharedPreferences.getString("prefMirrorData",getString(R.string.mirrordata_val)) + url; String mUrl = mySharedPreferences.getString("prefMirrorURL",getString(R.string.mirrorurl_val)); + String userAgent = getString(R.string.user_agent); Log.d(LOGTAG, "Download parse: " +url); ArrayList urls = new ArrayList(); @@ -165,7 +167,7 @@ public ArrayList getDLUrl(String url){ HttpURLConnection httpcon = (HttpURLConnection) ((new URL(mUrl).openConnection())); httpcon.setDoOutput(true); httpcon.setRequestMethod("POST"); - httpcon.setRequestProperty("User-Agent","Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0"); + httpcon.setRequestProperty("User-Agent",userAgent); httpcon.setRequestProperty("X-MOD-SBB-CTYPE","xhr"); httpcon.connect(); diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index c350b57..2cd0e00 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -12,4 +12,5 @@ .calc.md5 .md5 h1 + Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0