-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f9016c
commit dcb0b39
Showing
10 changed files
with
208 additions
and
42 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
Binary file not shown.
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 |
---|---|---|
@@ -1 +1 @@ | ||
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":20,"versionName":"1.9.6","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] | ||
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":21,"versionName":"1.9.7","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] |
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 was deleted.
Oops, something went wrong.
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
74 changes: 74 additions & 0 deletions
74
xgetter/src/main/java/com/htetznaing/xgetter/Core/DailyMotion.java
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,74 @@ | ||
package com.htetznaing.xgetter.Core; | ||
|
||
import com.htetznaing.xgetter.Model.XModel; | ||
import com.htetznaing.xgetter.Utils.Utils; | ||
|
||
import org.json.JSONArray; | ||
import org.json.JSONException; | ||
import org.json.JSONObject; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Iterator; | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
public class DailyMotion { | ||
|
||
public static ArrayList<XModel> fetch(String response){ | ||
ArrayList<XModel> xModels = new ArrayList<>(); | ||
try { | ||
JSONObject jsonObject = new JSONObject(getJson(response)).getJSONObject("metadata").getJSONObject("qualities"); | ||
Iterator<String> iterator = jsonObject.keys(); | ||
while(iterator.hasNext()) { | ||
String key = iterator.next(); | ||
JSONArray array = jsonObject.getJSONArray(key); | ||
for (int i=0;i<array.length();i++){ | ||
JSONObject temp = array.getJSONObject(i); | ||
String type = temp.getString("type"); | ||
String url = temp.getString("url"); | ||
if (key.contains("@")){ | ||
key = key.replace("@","-"); | ||
} | ||
String quality = key+"p"; | ||
if (type.contains("mp4")){ | ||
Utils.putModel(url,quality,xModels); | ||
} | ||
} | ||
} | ||
return xModels; | ||
} catch (JSONException e) { | ||
e.printStackTrace(); | ||
} | ||
return null; | ||
} | ||
|
||
private static String getJson(String html){ | ||
final String regex = "var ?config ?=(.*);"; | ||
|
||
final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE); | ||
final Matcher matcher = pattern.matcher(html); | ||
if (matcher.find()) { | ||
return matcher.group(1); | ||
} | ||
return null; | ||
} | ||
|
||
public static String getDailyMotionID(String link){ | ||
final String regex = "^.+dailymotion.com\\/(embed)?\\/?(video|hub)\\/([^_]+)[^#]*(#video=([^_&]+))?"; | ||
final Pattern pattern = Pattern.compile(regex); | ||
final Matcher matcher = pattern.matcher(link); | ||
if (matcher.find()) { | ||
if (matcher.group(5)!=null && !matcher.group(5).equals("null")){ | ||
return removeSlash(matcher.group(5)); | ||
}else return removeSlash(matcher.group(3)); | ||
} | ||
return null; | ||
} | ||
|
||
private static String removeSlash(String ogay){ | ||
if (ogay.contains("/")){ | ||
return ogay.replace("/",""); | ||
} | ||
return ogay; | ||
} | ||
} |
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
Oops, something went wrong.