Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

Commit

Permalink
Library Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
nhCoder committed Dec 17, 2019
1 parent cab1917 commit a77247a
Show file tree
Hide file tree
Showing 13 changed files with 426 additions and 383 deletions.
Binary file removed YoutubeExtractor.apk
Binary file not shown.
3 changes: 2 additions & 1 deletion YoutubeExtractor/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
android:resizeableActivity = "true">
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,33 @@ public class CipherManager {


private static String getDecipherCode(String Basejs) {

String DechipherCode;
String DecipherFun="decipher=function(a)" + RegexUtils.matchGroup(RegexDesipherFunctionCode, Basejs);
String RawName=RegexUtils.matchGroup(RegexVarName, DecipherFun).replace("$","\\$");;
String RealVarName=RawName.split("\\.")[0];
RegexFindVarCode = "var\\s" + RealVarName + "=.*?\\};"; // Word 1
String varCode=RegexUtils.matchGroup(RegexFindVarCode, Basejs);
DechipherCode = DecipherFun + "\n" + varCode;
LogUtils.log(DechipherCode);
//LogUtils.log("code= "+DechipherCode);
return DechipherCode;

}


/*this function checks if the deciphered findings is already present if not gets the funtion*/
public static String dechiperSig(String sig,String playerUrl) throws IOException{
if(cachedDechiperFunction==null){
cachedDechiperFunction=getDecipherCode(getPlayerCode(playerUrl));
}

return RhinoEngine(sig);
}



/* just gets the js player file content */
private static String getPlayerCode(String playerUrl) throws IOException {


return HTTPUtility.downloadPageSource(playerUrl);

}





private static String RhinoEngine(String s) {

Context rhino = Context.enter();
rhino.setOptimizationLevel(-1);
try {
Expand All @@ -71,12 +61,7 @@ private static String RhinoEngine(String s) {
finally {
Context.exit();
}

return s;
}





}
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.naveed.ytextractor.model.YoutubeMedia;
import com.naveed.ytextractor.model.YTMedia;
import com.naveed.ytextractor.model.YoutubeMeta;
import com.naveed.ytextractor.utils.ContextUtils;
import com.naveed.ytextractor.utils.LogUtils;
import com.universalvideoview.UniversalMediaController;
import com.universalvideoview.UniversalVideoView;
import java.util.List;
import android.widget.ListAdapter;
import java.util.ArrayList;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.AdapterView;
import android.widget.Adapter;
import com.naveed.ytextractor.utils.Utils;

public class MainActivity extends Activity {

Expand All @@ -33,6 +40,13 @@ public class MainActivity extends Activity {

private UniversalMediaController mMediaController;

private ListView list;

private ArrayAdapter<String> adapter;

private ArrayList<String> urls_li;





Expand All @@ -43,19 +57,23 @@ protected void onCreate(Bundle savedInstanceState) {
ContextUtils.init(this);
mVideoView = (UniversalVideoView) findViewById(R.id.videoView);
TextView loading=(TextView)findViewById(R.id.loading_text);
list = (ListView)findViewById(R.id.mainListView1);
urls_li = new ArrayList<>();
adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, urls_li);
list.setAdapter(adapter);
View bg=findViewById(R.id.loading_layout);
bg.setBackgroundColor(Color.TRANSPARENT);
loading.setText("LOADING");
mMediaController = (UniversalMediaController) findViewById(R.id.media_controller);
mVideoView.setMediaController(mMediaController);
mVideoView.setAutoRotation(false);
mVideoView.setVideoViewCallback(new UniversalVideoView.VideoViewCallback() {

private boolean isFullscreen;
//private boolean isFullscreen;
@Override
public void onScaleChange(boolean isFullscreen) {
this.isFullscreen = isFullscreen;

}

}

@Override
public void onPause(MediaPlayer mediaPlayer) { // Video pause
Expand All @@ -81,27 +99,35 @@ public void onBufferingEnd(MediaPlayer mediaPlayer) {// steam end loading
});
edit = (EditText)findViewById(R.id.mainEditText1);
btn = (Button)findViewById(R.id.mainButton1);
edit.setText("4H4Oizo7oOE");
edit.setText("https://youtu.be/4GuqB1BQVr4");
edit.setHint("id or url");
btn.setOnClickListener((new OnClickListener(){

@Override
public void onClick(View p1) {
Toast.makeText(getApplicationContext(), "Extracting", Toast.LENGTH_LONG).show();

new YoutubeStreamExtractor(new YoutubeStreamExtractor.ExtractorListner(){

@Override
public void onExtractionDone(List<YoutubeMedia> adativeStream, final List<YoutubeMedia> muxedStream, YoutubeMeta meta) {

public void onExtractionDone(List<YTMedia> adativeStream, final List<YTMedia> muxedStream, YoutubeMeta meta) {

for (YTMedia c:muxedStream) {
urls_li.add(c.getUrl());
adapter.notifyDataSetChanged();
}
for (YTMedia c:adativeStream) {
urls_li.add(c.getUrl());
adapter.notifyDataSetChanged();
}
Toast.makeText(getApplicationContext(), meta.getTitle(), Toast.LENGTH_LONG).show();
Toast.makeText(getApplicationContext(), meta.getAuthor(), Toast.LENGTH_LONG).show();


if (muxedStream.isEmpty()) {LogUtils.log("null ha");
return;}
if (muxedStream.isEmpty()) {
LogUtils.log("null ha");
return;
}
String url = muxedStream.get(0).getUrl();
LogUtils.log(url);
PlayVideo(url);


Expand All @@ -120,6 +146,17 @@ public void onExtractionGoesWrong(final ExtractorException e) {
}
}));


list.setOnItemClickListener(new AdapterView.OnItemClickListener(){

@Override
public void onItemClick(AdapterView<?> p1, View p2, int p3, long p4) {
Utils.copyToBoard(urls_li.get(p3));
Toast.makeText(getApplicationContext(), "copied", Toast.LENGTH_LONG).show();

}
});

}


Expand All @@ -134,13 +171,13 @@ private void PlayVideo(String url) {
mVideoView.requestFocus();
mVideoView.start();











}


Expand Down
Loading

0 comments on commit a77247a

Please sign in to comment.