Skip to content

Commit

Permalink
1.9.7
Browse files Browse the repository at this point in the history
  • Loading branch information
KhunHtetzNaing committed Aug 29, 2019
1 parent 9f9016c commit dcb0b39
Show file tree
Hide file tree
Showing 10 changed files with 208 additions and 42 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "com.htetznaing.xgetterexample"
minSdkVersion 19
targetSdkVersion 28
versionCode 20
versionName "1.9.6"
versionCode 21
versionName "1.9.7"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Binary file modified app/release/app-release.apk
Binary file not shown.
2 changes: 1 addition & 1 deletion app/release/output.json
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":{}}]
94 changes: 83 additions & 11 deletions app/src/main/java/com/htetznaing/xgetterexample/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
Expand All @@ -32,10 +33,21 @@
import com.htetznaing.xgetterexample.Utils.XDownloader;
import com.htetznaing.xplayer.XPlayer;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class MainActivity extends AppCompatActivity {
XGetter xGetter;
Expand Down Expand Up @@ -190,6 +202,10 @@ public void filerio(View view){
letGo("https://filerio.in/lgdgftj4vpfn");
}

public void dailymotion(View view) {
letGo("https://www.dailymotion.com/video/xyt1t1");
}

public boolean checkInternet() {
boolean what = false;
CheckInternet checkNet = new CheckInternet(this);
Expand Down Expand Up @@ -219,22 +235,14 @@ private void done(XModel xModel){
.onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
// Intent intent = new Intent(getApplicationContext(), SimpleVideoPlayer.class);
// intent.putExtra("url",finalUrl);
// //If google drive you need to put cookie
// if (xModel.getCookie()!=null){
// intent.putExtra("cookie",xModel.getCookie());
// }
// startActivity(intent);
watchVideo(xModel);
watchDialog(xModel);
}
})
.setNegativeText("Download")
.onNegative(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
// downloadFile(xModel);
downloadWithADM(xModel);
downloadDialog(xModel);
}
});
}else {
Expand All @@ -255,6 +263,69 @@ public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which)
dialog.show();
}

private void watchDialog(XModel xModel){
MaterialStyledDialog.Builder builder = new MaterialStyledDialog.Builder(this);
builder.setTitle("Notice!")
.setDescription("Choose your player")
.setStyle(Style.HEADER_WITH_ICON)
.setIcon(R.drawable.right)
.withDialogAnimation(true)
.setPositiveText("Simple Exoplayer")
.onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
Intent intent = new Intent(getApplicationContext(), SimpleVideoPlayer.class);
intent.putExtra("url",xModel.getUrl());
//If google drive you need to put cookie
if (xModel.getCookie()!=null){
intent.putExtra("cookie",xModel.getCookie());
}
startActivity(intent);
}
})
.setNegativeText("PIP")
.onNegative(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
watchVideo(xModel);
}
})
.setNeutralText("MXPlayer")
.onNeutral(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
openWithMXPlayer(xModel);
}
});
MaterialStyledDialog dialog = builder.build();
dialog.show();
}

private void downloadDialog(XModel xModel){
MaterialStyledDialog.Builder builder = new MaterialStyledDialog.Builder(this);
builder.setTitle("Notice!")
.setDescription("Choose your downloader")
.setStyle(Style.HEADER_WITH_ICON)
.setIcon(R.drawable.right)
.withDialogAnimation(true)
.setPositiveText("Built in downloader")
.onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
downloadFile(xModel);
}
})
.setNegativeText("ADM")
.onNegative(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
downloadWithADM(xModel);
}
});
MaterialStyledDialog dialog = builder.build();
dialog.show();
}

private void watchVideo(XModel xModel){
Intent intent = new Intent(this, XPlayer.class);
intent.putExtra(XPlayer.XPLAYER_URL, xModel.getUrl());
Expand Down Expand Up @@ -342,7 +413,8 @@ public void showAbout() {
"20. Uptobox\n" +
"21. FEmbed\n" +
"22. VeryStream\n" +
"23. FileRio\n"+
"23. FileRio\n" +
"24. DailyMotion\n" +
"\n" +
"Github Repo => https://github.com/KhunHtetzNaing/xGetter" +
"\n" +
Expand Down
12 changes: 0 additions & 12 deletions app/src/main/java/com/htetznaing/xgetterexample/Test.java

This file was deleted.

17 changes: 11 additions & 6 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<Button
android:onClick="filerio"
android:text="FileRio"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>

<LinearLayout
Expand Down Expand Up @@ -185,16 +190,16 @@
android:text="FEmbed"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<Button
android:onClick="dailymotion"
android:text="DailyMotion"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>

</LinearLayout>


<Button
android:onClick="filerio"
android:text="FileRio"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</ScrollView>

Expand Down
6 changes: 3 additions & 3 deletions xgetter/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
group='com.htetznaing'
version='1.9.6'
version='1.9.7'

android {
compileSdkVersion 26
defaultConfig {
minSdkVersion 17
targetSdkVersion 26
versionCode 20
versionName "1.9.6"
versionCode 21
versionName "1.9.7"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Expand Down
74 changes: 74 additions & 0 deletions xgetter/src/main/java/com/htetznaing/xgetter/Core/DailyMotion.java
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;
}
}
8 changes: 6 additions & 2 deletions xgetter/src/main/java/com/htetznaing/xgetter/Core/Fembed.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,15 @@ public static ArrayList<XModel> fetch(String response){


public static String get_fEmbed_video_ID(String string){
final String regex = "(v|f)(\\/|=)(\\w+)(\\/|&)?";
final String regex = "(v|f)(\\/|=)(.+)(\\/|&)?";
final Pattern pattern = Pattern.compile(regex);
final Matcher matcher = pattern.matcher(string);
if (matcher.find()) {
return matcher.group(3);
String id = matcher.group(3);
if (id.contains("/")){
id = id.replace("/","");
}
return id;
}
return null;
}
Expand Down
Loading

0 comments on commit dcb0b39

Please sign in to comment.