forked from rumboalla/apkupdater
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from hemker/dev
Adding new APKMirror features
- Loading branch information
Showing
7 changed files
with
60 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package de.apkgrabber.util; | ||
|
||
|
||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
import okhttp3.OkHttpClient; | ||
import okhttp3.Request; | ||
|
||
public class APKMirrorParser { | ||
public static String parseDownloadUrlFromWebsite(String url) { | ||
String downloadUrl = ""; | ||
try { | ||
OkHttpClient client = new OkHttpClient(); | ||
Request r = new Request.Builder().url(url).build(); | ||
String response = client.newCall(r).execute().body().string(); | ||
|
||
String baseUrl = "/wp-content/themes/APKMirror/"; | ||
Pattern pattern = Pattern.compile(baseUrl + ".*here"); | ||
Matcher match = pattern.matcher(response); | ||
|
||
if(match.find()) { | ||
downloadUrl = response.substring(match.start(), match.end() - 6); | ||
} | ||
} catch (Exception e) { | ||
} | ||
return downloadUrl; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters