mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-21 23:50:32 +00:00
merged commits from origin
This commit is contained in:
commit
9e7d9ee973
@ -127,6 +127,8 @@ public class VideoItemDetailFragment extends Fragment {
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
//todo: fix expired thread error:
|
||||
// If the thread calling this runnable is expired, the following function will crash.
|
||||
updateInfo(videoInfo);
|
||||
}
|
||||
}
|
||||
@ -201,11 +203,13 @@ public class VideoItemDetailFragment extends Fragment {
|
||||
.getViewByVideoInfoItem(null, nextVideoFrame, info.nextVideo);
|
||||
nextVideoFrame.addView(nextVideoView);
|
||||
Button nextVideoButton = (Button) activity.findViewById(R.id.detailNextVideoButton);
|
||||
Button similarVideosButton = (Button) activity.findViewById(R.id.detailShowSimilarButton);
|
||||
|
||||
contentMainView.setVisibility(View.VISIBLE);
|
||||
progressBar.setVisibility(View.GONE);
|
||||
if(!showNextVideoItem) {
|
||||
nextVideoRootFrame.setVisibility(View.GONE);
|
||||
similarVideosButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
switch (info.videoAvailableStatus) {
|
||||
|
@ -91,9 +91,45 @@ public class YoutubeExtractor implements Extractor {
|
||||
}
|
||||
}
|
||||
|
||||
private String decryptionCode = "";
|
||||
|
||||
// static values
|
||||
private static final String DECRYPTION_FUNC_NAME="decrypt";
|
||||
|
||||
// cached values
|
||||
private static volatile String decryptionCode = "";
|
||||
|
||||
public void initService(String site) {
|
||||
// The Youtube service needs to be initialized by downloading the
|
||||
// js-Youtube-player. This is done in order to get the algorithm
|
||||
// for decrypting cryptic signatures inside certain stream urls.
|
||||
|
||||
// Star Wars Kid is used as a dummy video, in order to download the youtube player.
|
||||
//String site = Downloader.download("https://www.youtube.com/watch?v=HPPj6viIBmU");
|
||||
//-------------------------------------
|
||||
// extracting form player args
|
||||
//-------------------------------------
|
||||
try {
|
||||
String jsonString = matchGroup1("ytplayer.config\\s*=\\s*(\\{.*?\\});", site);
|
||||
JSONObject jsonObj = new JSONObject(jsonString);
|
||||
|
||||
//----------------------------------
|
||||
// load an parse description code
|
||||
//----------------------------------
|
||||
if (decryptionCode.isEmpty()) {
|
||||
JSONObject ytAssets = jsonObj.getJSONObject("assets");
|
||||
String playerUrl = ytAssets.getString("js");
|
||||
if (playerUrl.startsWith("//")) {
|
||||
playerUrl = "https:" + playerUrl;
|
||||
}
|
||||
decryptionCode = loadDecryptionCode(playerUrl);
|
||||
}
|
||||
|
||||
} catch (Exception e){
|
||||
Log.d(TAG, "Could not initialize the extractor of the Youtube service.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVideoId(String videoUrl) {
|
||||
try {
|
||||
@ -147,18 +183,18 @@ public class YoutubeExtractor implements Extractor {
|
||||
videoInfo.age_limit = 0;
|
||||
videoInfo.webpage_url = siteUrl;
|
||||
|
||||
|
||||
initService(site);
|
||||
|
||||
//-------------------------------------
|
||||
// extracting form player args
|
||||
//-------------------------------------
|
||||
JSONObject playerArgs = null;
|
||||
JSONObject ytAssets = null;
|
||||
String dashManifest;
|
||||
{
|
||||
try {
|
||||
String jsonString = matchGroup1("ytplayer.config\\s*=\\s*(\\{.*?\\});", site);
|
||||
JSONObject jsonObj = new JSONObject(jsonString);
|
||||
playerArgs = jsonObj.getJSONObject("args");
|
||||
ytAssets = jsonObj.getJSONObject("assets");
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -168,7 +204,24 @@ public class YoutubeExtractor implements Extractor {
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------
|
||||
// load and extract audio
|
||||
//-----------------------
|
||||
try {
|
||||
String dashManifest = playerArgs.getString("dashmpd");
|
||||
videoInfo.audioStreams = parseDashManifest(dashManifest, decryptionCode);
|
||||
|
||||
} catch (NullPointerException e) {
|
||||
Log.e(TAG, "Could not find \"dashmpd\" upon the player args (maybe no dash manifest available).");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
//--------------------------------------------
|
||||
// extract general information about the video
|
||||
//--------------------------------------------
|
||||
|
||||
videoInfo.uploader = playerArgs.getString("author");
|
||||
videoInfo.title = playerArgs.getString("title");
|
||||
//first attempt gating a small image version
|
||||
@ -176,23 +229,6 @@ public class YoutubeExtractor implements Extractor {
|
||||
videoInfo.thumbnail_url = playerArgs.getString("thumbnail_url");
|
||||
videoInfo.duration = playerArgs.getInt("length_seconds");
|
||||
videoInfo.average_rating = playerArgs.getString("avg_rating");
|
||||
String playerUrl = ytAssets.getString("js");
|
||||
if(playerUrl.startsWith("//")) {
|
||||
playerUrl = "https:" + playerUrl;
|
||||
}
|
||||
if(decryptionCode.isEmpty()) {
|
||||
decryptionCode = loadDecryptionCode(playerUrl);
|
||||
}
|
||||
|
||||
// extract audio
|
||||
try {
|
||||
dashManifest = playerArgs.getString("dashmpd");
|
||||
videoInfo.audioStreams = parseDashManifest(dashManifest, decryptionCode);
|
||||
} catch (Exception e) {
|
||||
//todo: check if the following statement is true
|
||||
Log.e(TAG, "Dash manifest doesn't seem to be available.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
// extract video stream url
|
||||
@ -211,9 +247,6 @@ public class YoutubeExtractor implements Extractor {
|
||||
|
||||
// if video has a signature: decrypt it and add it to the url
|
||||
if(tags.get("s") != null) {
|
||||
if(decryptionCode.isEmpty()) {
|
||||
decryptionCode = loadDecryptionCode(playerUrl);
|
||||
}
|
||||
streamUrl = streamUrl + "&signature=" + decryptSignature(tags.get("s"), decryptionCode);
|
||||
}
|
||||
|
||||
@ -231,9 +264,9 @@ public class YoutubeExtractor implements Extractor {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
//-------------------------------
|
||||
// extracting from html page
|
||||
//-------------------------------
|
||||
//---------------------------------------
|
||||
// extracting information from html page
|
||||
//---------------------------------------
|
||||
|
||||
|
||||
// Determine what went wrong when the Video is not available
|
||||
|
@ -46,7 +46,7 @@
|
||||
<item>Audio</item>
|
||||
</string-array>
|
||||
<string name="nextVideoTitle">Nächstes Video</string>
|
||||
<string name="showNextVideoTitle">Zeige \"Nächstes Video\" Auswahl.</string>
|
||||
<string name="showNextAndSimilarTitle">Zeige nächstes und änliche Videos.</string>
|
||||
<string name="urlNotSupportedText">Url wird nicht unterstützt.</string>
|
||||
<string name="showSimilarVideosButtonText">Ähnliche Videos</string>
|
||||
</resources>
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<resources>
|
||||
<string name="app_name">NewPipe</string>
|
||||
<string name="title_videoitem_detail">NewPipe</string>
|
||||
@ -6,17 +6,17 @@
|
||||
<string name="viewSufix">visitas</string>
|
||||
<string name="uploadDatePrefix">Subido desde: </string>
|
||||
<string name="noPlayerFound">No se ha encontrado ningún reproductor de vídeo. Quizás quieras instalar alguno.</string>
|
||||
<string name="installStreamPlayer">Instalar</string>
|
||||
<string name="installStreamPlayer">Instalarlo</string>
|
||||
<string name="cancel">Cancelar</string>
|
||||
<string name="fdroidVLCurl">https://f-droid.org/repository/browse/?fdfilter=vlc&fdid=org.videolan.vlc</string>
|
||||
<string name="open_in_browser">Abrir en navegador</string>
|
||||
<string name="open_in_browser">Abrir en el navegador</string>
|
||||
<string name="share">Compartir</string>
|
||||
<string name="play">Reproducir</string>
|
||||
<string name="download">Descargar</string>
|
||||
<string name="search">Buscar</string>
|
||||
<string name="settings">Ajustes</string>
|
||||
<string name="sendWith">Enviar con</string>
|
||||
<string name="didYouMean">Querias decir: </string>
|
||||
<string name="didYouMean">"¿Querías decir?: "</string>
|
||||
<string name="searchPage">Buscar página: </string>
|
||||
<string name="shareDialogTitle">Compartir con:</string>
|
||||
<string name="chooseBrowser">Selecciona navegador:</string>
|
||||
@ -24,15 +24,26 @@
|
||||
<string name="title_activity_settings">Ajustes</string>
|
||||
<string name="useExternalPlayerTitle">Usar reproductor externo</string>
|
||||
<string name="downloadLocation">Descargar en...</string>
|
||||
<string name="downloadLocationSummary">Donde se guardarán los vídeos descargados.</string>
|
||||
<string name="downloadLocationSummary">Ruta donde guardar los vídeos descargados.</string>
|
||||
<string name="downloadLocationDialogTitle">Localización del directorio de descargas</string>
|
||||
<string name="autoPlayThroughIntentTitle">Reproducción automática</string>
|
||||
<string name="autoPlayThroughIntentSummary">Reproduce los vídeos automaticamente cuando la llamada viene de otra aplicación.</string>
|
||||
<string name="autoPlayThroughIntentSummary">Reproducir los vídeos automaticamente cuando se llama desde otra aplicación.</string>
|
||||
<string name="defaultResolutionPreferenceTitle">Resolución por defecto</string>
|
||||
<string name="playWithKodiTitle">Reproducir con Kodi</string>
|
||||
<string name="koreNotFound">Aplicación Kore no encontrada. Kore es necesario para reproducir vídeos con Kodi media center.</string>
|
||||
<string name="installeKore">Instalar Kore</string>
|
||||
<string name="fdroidKoreUrl">https://f-droid.org/repository/browse/?fdfilter=Kore&fdid=org.xbmc.kore</string>
|
||||
<string name="showPlayWithKodiTitle">Mostrar la opción \"Reproducir con Kodi\"</string>
|
||||
<string name="showPlayWithKodiSummary">Muestra una opción para reproducir vídeo vía Kodi media center.</string>
|
||||
<string name="showPlayWithKodiSummary">Muestra una opción para reproducir el vídeo con Kodi media center.</string>
|
||||
<string name="leftPlayButtonTitle">Mostrar el botón de reproducir en el lado izquierdo.</string>
|
||||
<string name="playAudio">Audio</string>
|
||||
<string name="defaultAudioFormatTitle">Formato de audio por defecto</string>
|
||||
<string name="webMAudioDescription">WebM - formato libre</string>
|
||||
<string name="m4aAudioDescription">m4a - mejor calidad</string>
|
||||
<string name="downloadDialogTitle">Descargar</string>
|
||||
<string name="nextVideoTitle">Siguiente vídeo</string>
|
||||
<string name="showNextVideoTitle">Mostrar la opción \"Siguiente vídeo\".</string>
|
||||
<string name="urlNotSupportedText">Url no soportada.</string>
|
||||
<string name="showSimilarVideosButtonText">Vídeos similares</string>
|
||||
<string name="contentCountryTitle">País del contenido del vídeo</string>
|
||||
</resources>
|
||||
|
@ -48,4 +48,5 @@
|
||||
<string name="nextVideoTitle">Következő videó</string>
|
||||
<string name="showNextVideoTitle">\"Következő videó\" elem mutatása</string>
|
||||
<string name="urlNotSupportedText">A webcím nem támogatott.</string>
|
||||
</resources>
|
||||
<string name="showSimilarVideosButtonText">Hasonló videók</string>
|
||||
</resources>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<string name="nothingFound">Geen resultaten</string>
|
||||
<string name="viewSufix">keer bekeken</string>
|
||||
<string name="uploadDatePrefix">Geüpload op: </string>
|
||||
<string name="noPlayerFound">Geen speler met streaming ondersteuning gevonden. Je wilt er misschien een installeren.</string>
|
||||
<string name="noPlayerFound">Geen speler met streaming ondersteuning gevonden. Misschien wil je er een installeren</string>
|
||||
<string name="installStreamPlayer">Installeer speler</string>
|
||||
<string name="cancel">Annuleer</string>
|
||||
<string name="fdroidVLCurl">https://f-droid.org/repository/browse/?fdfilter=vlc&fdid=org.videolan.vlc</string>
|
||||
@ -35,4 +35,15 @@
|
||||
<string name="fdroidKoreUrl">https://f-droid.org/repository/browse/?fdfilter=Kore&fdid=org.xbmc.kore</string>
|
||||
<string name="showPlayWithKodiTitle">Toon \"Speel af met Kodi\" optie</string>
|
||||
<string name="showPlayWithKodiSummary">Toont een optie om een video op een Kodi media center af te spelen.</string>
|
||||
</resources>
|
||||
<string name="contentCountryTitle">Video inhoud land</string>
|
||||
<string name="leftPlayButtonTitle">Afspeel knop aan de linker kant weergeven</string>
|
||||
<string name="playAudio">Audio</string>
|
||||
<string name="defaultAudioFormatTitle">Standaard audio formaat</string>
|
||||
<string name="webMAudioDescription">Webam - open formaat</string>
|
||||
<string name="m4aAudioDescription">m4a - betere kwaliteit</string>
|
||||
<string name="downloadDialogTitle">Download</string>
|
||||
<string name="nextVideoTitle">Volgende video</string>
|
||||
<string name="showNextVideoTitle">\"Volgende video\" weergeven</string>
|
||||
<string name="urlNotSupportedText">Url wordt niet ondersteund</string>
|
||||
<string name="showSimilarVideosButtonText">Vergelijkbare videos</string>
|
||||
</resources>
|
||||
|
@ -46,7 +46,7 @@
|
||||
<item>Audio</item>
|
||||
</string-array>
|
||||
<string name="nextVideoTitle">Next Video</string>
|
||||
<string name="showNextVideoTitle">Show \"Next video\" item.</string>
|
||||
<string name="showNextAndSimilarTitle">Show next and similar Videos.</string>
|
||||
<string name="urlNotSupportedText">Url not Supported.</string>
|
||||
<string name="showSimilarVideosButtonText">Similar Videos</string>
|
||||
<string name="searchLanguageTitle">Video Search Language</string>
|
||||
|
@ -48,13 +48,16 @@
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="@string/showNextVideo"
|
||||
android:title="@string/showNextVideoTitle"
|
||||
android:title="@string/showNextAndSimilarTitle"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<!-- This function is not yet available
|
||||
<ListPreference
|
||||
android:key="@string/searchLanguage"
|
||||
android:title="@string/searchLanguageTitle"
|
||||
android:entries="@array/languageNames"
|
||||
android:entryValues="@array/languageCodes"
|
||||
android:defaultValue="" /> <!-- default will include no country code in URL-->
|
||||
android:defaultValue="en" />
|
||||
|
||||
-->
|
||||
</PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user