6 Commits

Author SHA1 Message Date
Renato
1526766630 v10.1.11: Aceptar todos los certificados SSL para streams con redirección 2026-02-19 16:59:53 -03:00
Renato
4e92ee6149 v10.1.10: Cambiar a HTTP para evitar errores de certificado 2026-02-19 16:54:04 -03:00
Renato
cff9658060 v10.1.12: Revertir a código v10.1.7 funcional con dominio streamtp10.com
- PlayerActivity: Referer vuelve a ser channelUrl (URL específica del canal)
- StreamUrlResolver: Vuelve a crear su propio cliente con Google DNS
- Eliminados cambios problemáticos de SSL trust-all y múltiples DNS
- Mantenidos solo los cambios necesarios: streamtp10.com en lugar de streamtpcloud.com

Esto debería hacer que los streams vuelvan a funcionar como en v10.1.7
2026-02-15 19:18:01 -03:00
Renato
43439e0a88 v10.1.11: Fix mensajes de error - eliminar HTML crudo que mostraba símbolos extraños
- StreamUrlResolver ya no muestra HTML crudo en mensajes de error
- Agregada validación para detectar respuestas comprimidas/binarias
- Mejorados mensajes de error para ser más claros y sin caracteres raros
- Agregados más patrones de extracción de URLs
- Eliminado Accept-Encoding para evitar respuestas comprimidas
2026-02-15 19:08:52 -03:00
Renato
98473e3b30 v10.1.10: Fix reproducción de streams con SSL MITM y mejoras DNS
- Corregido PlayerActivity para usar NetworkUtils con 4 servidores DNS
- Agregado soporte para certificados SSL no válidos (evita MITM de ISP)
- Actualizados headers Referer y Origin a streamtp10.com
- Mejorado StreamUrlResolver con múltiples patrones de extracción
- Aumentados timeouts de red a 20-30 segundos
- Agregado manejo de errores 401/403/404 específicos
2026-02-15 18:57:54 -03:00
Renato
a4e8deb45a Fix DNS issues: Add 4 DoH servers with fallback, remove ineffective DNSSetter
- Remove DNSSetter.java (System.setProperty doesn't affect Android DNS)
- Update NetworkUtils with 4 DNS over HTTPS providers:
  * Google DNS (8.8.8.8) - Primary
  * Cloudflare (1.1.1.1) - Secondary
  * AdGuard (94.140.14.14) - Tertiary
  * Quad9 (9.9.9.9) - Quaternary
- Update DeviceRegistry to use NetworkUtils client
- Update UpdateManager to use NetworkUtils client
- Remove DNSSetter call from PlayerActivity

This ensures the app works even when ISPs block specific DNS servers.
2026-02-12 21:53:44 -03:00
10 changed files with 266 additions and 223 deletions

View File

@@ -8,8 +8,8 @@ android {
applicationId "com.streamplayer"
minSdk 21
targetSdk 35
versionCode 100108
versionName "10.1.8"
versionCode 100111
versionName "10.1.11"
buildConfigField "String", "DEVICE_REGISTRY_URL", '"http://194.163.191.200:4000"'
}

View File

@@ -12,72 +12,72 @@ public final class ChannelRepository {
private static List<StreamChannel> createChannels() {
List<StreamChannel> channels = new ArrayList<>(Arrays.asList(
new StreamChannel("ESPN", "https://streamtp10.com/global2.php?stream=espn"),
new StreamChannel("ESPN 2", "https://streamtp10.com/global2.php?stream=espn2"),
new StreamChannel("ESPN 3", "https://streamtp10.com/global2.php?stream=espn3"),
new StreamChannel("ESPN 4", "https://streamtp10.com/global2.php?stream=espn4"),
new StreamChannel("ESPN 3 MX", "https://streamtp10.com/global2.php?stream=espn3mx"),
new StreamChannel("ESPN 5", "https://streamtp10.com/global2.php?stream=espn5"),
new StreamChannel("Fox Sports 3 MX", "https://streamtp10.com/global2.php?stream=foxsports3mx"),
new StreamChannel("ESPN 6", "https://streamtp10.com/global2.php?stream=espn6"),
new StreamChannel("Fox Sports MX", "https://streamtp10.com/global2.php?stream=foxsportsmx"),
new StreamChannel("ESPN 7", "https://streamtp10.com/global2.php?stream=espn7"),
new StreamChannel("Azteca Deportes", "https://streamtp10.com/global2.php?stream=azteca_deportes"),
new StreamChannel("Win Plus", "https://streamtp10.com/global2.php?stream=winplus"),
new StreamChannel("DAZN 1", "https://streamtp10.com/global2.php?stream=dazn1"),
new StreamChannel("Win Plus 2", "https://streamtp10.com/global2.php?stream=winplus2"),
new StreamChannel("DAZN 2", "https://streamtp10.com/global2.php?stream=dazn2"),
new StreamChannel("Win Sports", "https://streamtp10.com/global2.php?stream=winsports"),
new StreamChannel("DAZN LaLiga", "https://streamtp10.com/global2.php?stream=dazn_laliga"),
new StreamChannel("Win Plus Online 1", "https://streamtp10.com/global2.php?stream=winplusonline1"),
new StreamChannel("Caracol TV", "https://streamtp10.com/global2.php?stream=caracoltv"),
new StreamChannel("Fox 1 AR", "https://streamtp10.com/global2.php?stream=fox1ar"),
new StreamChannel("Fox 2 USA", "https://streamtp10.com/global2.php?stream=fox_2_usa"),
new StreamChannel("Fox 2 AR", "https://streamtp10.com/global2.php?stream=fox2ar"),
new StreamChannel("TNT 1 GB", "https://streamtp10.com/global2.php?stream=tnt_1_gb"),
new StreamChannel("TNT 2 GB", "https://streamtp10.com/global2.php?stream=tnt_2_gb"),
new StreamChannel("Fox 3 AR", "https://streamtp10.com/global2.php?stream=fox3ar"),
new StreamChannel("Universo USA", "https://streamtp10.com/global2.php?stream=universo_usa"),
new StreamChannel("DSports", "https://streamtp10.com/global2.php?stream=dsports"),
new StreamChannel("Univision USA", "https://streamtp10.com/global2.php?stream=univision_usa"),
new StreamChannel("DSports 2", "https://streamtp10.com/global2.php?stream=dsports2"),
new StreamChannel("Fox Deportes USA", "https://streamtp10.com/global2.php?stream=fox_deportes_usa"),
new StreamChannel("DSports Plus", "https://streamtp10.com/global2.php?stream=dsportsplus"),
new StreamChannel("Fox Sports 2 MX", "https://streamtp10.com/global2.php?stream=foxsports2mx"),
new StreamChannel("TNT Sports Chile", "https://streamtp10.com/global2.php?stream=tntsportschile"),
new StreamChannel("Fox Sports Premium", "https://streamtp10.com/global2.php?stream=foxsportspremium"),
new StreamChannel("TNT Sports", "https://streamtp10.com/global2.php?stream=tntsports"),
new StreamChannel("ESPN MX", "https://streamtp10.com/global2.php?stream=espnmx"),
new StreamChannel("ESPN Premium", "https://streamtp10.com/global2.php?stream=espnpremium"),
new StreamChannel("ESPN 2 MX", "https://streamtp10.com/global2.php?stream=espn2mx"),
new StreamChannel("TyC Sports", "https://streamtp10.com/global2.php?stream=tycsports"),
new StreamChannel("TUDN USA", "https://streamtp10.com/global2.php?stream=tudn_usa"),
new StreamChannel("Telefe", "https://streamtp10.com/global2.php?stream=telefe"),
new StreamChannel("TNT 3 GB", "https://streamtp10.com/global2.php?stream=tnt_3_gb"),
new StreamChannel("TV Pública", "https://streamtp10.com/global2.php?stream=tv_publica"),
new StreamChannel("Fox 1 USA", "https://streamtp10.com/global2.php?stream=fox_1_usa"),
new StreamChannel("Liga 1 Max", "https://streamtp10.com/global2.php?stream=liga1max"),
new StreamChannel("Gol TV", "https://streamtp10.com/global2.php?stream=goltv"),
new StreamChannel("VTV Plus", "https://streamtp10.com/global2.php?stream=vtvplus"),
new StreamChannel("ESPN Deportes", "https://streamtp10.com/global2.php?stream=espndeportes"),
new StreamChannel("Gol Perú", "https://streamtp10.com/global2.php?stream=golperu"),
new StreamChannel("TNT 4 GB", "https://streamtp10.com/global2.php?stream=tnt_4_gb"),
new StreamChannel("SportTV BR 1", "https://streamtp10.com/global2.php?stream=sporttvbr1"),
new StreamChannel("SportTV BR 2", "https://streamtp10.com/global2.php?stream=sporttvbr2"),
new StreamChannel("SportTV BR 3", "https://streamtp10.com/global2.php?stream=sporttvbr3"),
new StreamChannel("Premiere 1", "https://streamtp10.com/global2.php?stream=premiere1"),
new StreamChannel("Premiere 2", "https://streamtp10.com/global2.php?stream=premiere2"),
new StreamChannel("Premiere 3", "https://streamtp10.com/global2.php?stream=premiere3"),
new StreamChannel("ESPN NL 1", "https://streamtp10.com/global2.php?stream=espn_nl1"),
new StreamChannel("ESPN NL 2", "https://streamtp10.com/global2.php?stream=espn_nl2"),
new StreamChannel("ESPN NL 3", "https://streamtp10.com/global2.php?stream=espn_nl3"),
new StreamChannel("Caliente TV MX", "https://streamtp10.com/global2.php?stream=calientetvmx"),
new StreamChannel("USA Network", "https://streamtp10.com/global2.php?stream=usa_network"),
new StreamChannel("TyC Internacional", "https://streamtp10.com/global2.php?stream=tycinternacional"),
new StreamChannel("Canal 5 MX", "https://streamtp10.com/global2.php?stream=canal5mx"),
new StreamChannel("TUDN MX", "https://streamtp10.com/global2.php?stream=TUDNMX"),
new StreamChannel("FUTV", "https://streamtp10.com/global2.php?stream=futv"),
new StreamChannel("LaLiga Hypermotion", "https://streamtp10.com/global2.php?stream=laligahypermotion")
new StreamChannel("ESPN", "http://streamtp10.com/global2.php?stream=espn"),
new StreamChannel("ESPN 2", "http://streamtp10.com/global2.php?stream=espn2"),
new StreamChannel("ESPN 3", "http://streamtp10.com/global2.php?stream=espn3"),
new StreamChannel("ESPN 4", "http://streamtp10.com/global2.php?stream=espn4"),
new StreamChannel("ESPN 3 MX", "http://streamtp10.com/global2.php?stream=espn3mx"),
new StreamChannel("ESPN 5", "http://streamtp10.com/global2.php?stream=espn5"),
new StreamChannel("Fox Sports 3 MX", "http://streamtp10.com/global2.php?stream=foxsports3mx"),
new StreamChannel("ESPN 6", "http://streamtp10.com/global2.php?stream=espn6"),
new StreamChannel("Fox Sports MX", "http://streamtp10.com/global2.php?stream=foxsportsmx"),
new StreamChannel("ESPN 7", "http://streamtp10.com/global2.php?stream=espn7"),
new StreamChannel("Azteca Deportes", "http://streamtp10.com/global2.php?stream=azteca_deportes"),
new StreamChannel("Win Plus", "http://streamtp10.com/global2.php?stream=winplus"),
new StreamChannel("DAZN 1", "http://streamtp10.com/global2.php?stream=dazn1"),
new StreamChannel("Win Plus 2", "http://streamtp10.com/global2.php?stream=winplus2"),
new StreamChannel("DAZN 2", "http://streamtp10.com/global2.php?stream=dazn2"),
new StreamChannel("Win Sports", "http://streamtp10.com/global2.php?stream=winsports"),
new StreamChannel("DAZN LaLiga", "http://streamtp10.com/global2.php?stream=dazn_laliga"),
new StreamChannel("Win Plus Online 1", "http://streamtp10.com/global2.php?stream=winplusonline1"),
new StreamChannel("Caracol TV", "http://streamtp10.com/global2.php?stream=caracoltv"),
new StreamChannel("Fox 1 AR", "http://streamtp10.com/global2.php?stream=fox1ar"),
new StreamChannel("Fox 2 USA", "http://streamtp10.com/global2.php?stream=fox_2_usa"),
new StreamChannel("Fox 2 AR", "http://streamtp10.com/global2.php?stream=fox2ar"),
new StreamChannel("TNT 1 GB", "http://streamtp10.com/global2.php?stream=tnt_1_gb"),
new StreamChannel("TNT 2 GB", "http://streamtp10.com/global2.php?stream=tnt_2_gb"),
new StreamChannel("Fox 3 AR", "http://streamtp10.com/global2.php?stream=fox3ar"),
new StreamChannel("Universo USA", "http://streamtp10.com/global2.php?stream=universo_usa"),
new StreamChannel("DSports", "http://streamtp10.com/global2.php?stream=dsports"),
new StreamChannel("Univision USA", "http://streamtp10.com/global2.php?stream=univision_usa"),
new StreamChannel("DSports 2", "http://streamtp10.com/global2.php?stream=dsports2"),
new StreamChannel("Fox Deportes USA", "http://streamtp10.com/global2.php?stream=fox_deportes_usa"),
new StreamChannel("DSports Plus", "http://streamtp10.com/global2.php?stream=dsportsplus"),
new StreamChannel("Fox Sports 2 MX", "http://streamtp10.com/global2.php?stream=foxsports2mx"),
new StreamChannel("TNT Sports Chile", "http://streamtp10.com/global2.php?stream=tntsportschile"),
new StreamChannel("Fox Sports Premium", "http://streamtp10.com/global2.php?stream=foxsportspremium"),
new StreamChannel("TNT Sports", "http://streamtp10.com/global2.php?stream=tntsports"),
new StreamChannel("ESPN MX", "http://streamtp10.com/global2.php?stream=espnmx"),
new StreamChannel("ESPN Premium", "http://streamtp10.com/global2.php?stream=espnpremium"),
new StreamChannel("ESPN 2 MX", "http://streamtp10.com/global2.php?stream=espn2mx"),
new StreamChannel("TyC Sports", "http://streamtp10.com/global2.php?stream=tycsports"),
new StreamChannel("TUDN USA", "http://streamtp10.com/global2.php?stream=tudn_usa"),
new StreamChannel("Telefe", "http://streamtp10.com/global2.php?stream=telefe"),
new StreamChannel("TNT 3 GB", "http://streamtp10.com/global2.php?stream=tnt_3_gb"),
new StreamChannel("TV Pública", "http://streamtp10.com/global2.php?stream=tv_publica"),
new StreamChannel("Fox 1 USA", "http://streamtp10.com/global2.php?stream=fox_1_usa"),
new StreamChannel("Liga 1 Max", "http://streamtp10.com/global2.php?stream=liga1max"),
new StreamChannel("Gol TV", "http://streamtp10.com/global2.php?stream=goltv"),
new StreamChannel("VTV Plus", "http://streamtp10.com/global2.php?stream=vtvplus"),
new StreamChannel("ESPN Deportes", "http://streamtp10.com/global2.php?stream=espndeportes"),
new StreamChannel("Gol Perú", "http://streamtp10.com/global2.php?stream=golperu"),
new StreamChannel("TNT 4 GB", "http://streamtp10.com/global2.php?stream=tnt_4_gb"),
new StreamChannel("SportTV BR 1", "http://streamtp10.com/global2.php?stream=sporttvbr1"),
new StreamChannel("SportTV BR 2", "http://streamtp10.com/global2.php?stream=sporttvbr2"),
new StreamChannel("SportTV BR 3", "http://streamtp10.com/global2.php?stream=sporttvbr3"),
new StreamChannel("Premiere 1", "http://streamtp10.com/global2.php?stream=premiere1"),
new StreamChannel("Premiere 2", "http://streamtp10.com/global2.php?stream=premiere2"),
new StreamChannel("Premiere 3", "http://streamtp10.com/global2.php?stream=premiere3"),
new StreamChannel("ESPN NL 1", "http://streamtp10.com/global2.php?stream=espn_nl1"),
new StreamChannel("ESPN NL 2", "http://streamtp10.com/global2.php?stream=espn_nl2"),
new StreamChannel("ESPN NL 3", "http://streamtp10.com/global2.php?stream=espn_nl3"),
new StreamChannel("Caliente TV MX", "http://streamtp10.com/global2.php?stream=calientetvmx"),
new StreamChannel("USA Network", "http://streamtp10.com/global2.php?stream=usa_network"),
new StreamChannel("TyC Internacional", "http://streamtp10.com/global2.php?stream=tycinternacional"),
new StreamChannel("Canal 5 MX", "http://streamtp10.com/global2.php?stream=canal5mx"),
new StreamChannel("TUDN MX", "http://streamtp10.com/global2.php?stream=TUDNMX"),
new StreamChannel("FUTV", "http://streamtp10.com/global2.php?stream=futv"),
new StreamChannel("LaLiga Hypermotion", "http://streamtp10.com/global2.php?stream=laligahypermotion")
));
channels.sort(Comparator.comparing(StreamChannel::getName, String.CASE_INSENSITIVE_ORDER));
return Collections.unmodifiableList(channels);

View File

@@ -1,109 +0,0 @@
package com.streamplayer;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
import android.os.Build;
import java.net.InetAddress;
public class DNSSetter {
private static final String[] GOOGLE_DNS = {"8.8.8.8", "8.8.4.4"};
public static void configureDNSToGoogle(Context context) {
try {
// Configurar propiedades del sistema para usar DNS específicos
System.setProperty("networkaddress.cache.ttl", "60");
System.setProperty("networkaddress.cache.negative.ttl", "10");
// Forzar resolución usando DNS de Google
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
configureModernDNS(context);
} else {
configureLegacyDNS();
}
// Pre-resolver dominio con DNS de Google
preResolveWithGoogleDNS();
} catch (Exception e) {
System.out.println("Error configurando DNS de Google: " + e.getMessage());
}
}
private static void configureModernDNS(Context context) {
try {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkRequest networkRequest = new NetworkRequest.Builder()
.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
.build();
connectivityManager.registerNetworkCallback(networkRequest, new ConnectivityManager.NetworkCallback() {
@Override
public void onAvailable(Network network) {
super.onAvailable(network);
// Configuración para priorizar DNS de Google
// Aunque no podemos cambiar DNS directamente sin permisos especiales,
// podemos optimizar la configuración de red
try {
NetworkCapabilities caps = connectivityManager.getNetworkCapabilities(network);
if (caps != null) {
System.out.println("Red configurada con DNS optimizado para streaming");
}
} catch (Exception e) {
System.out.println("Error en configuración de red: " + e.getMessage());
}
}
});
} catch (Exception e) {
System.out.println("Error configurando DNS moderno: " + e.getMessage());
}
}
private static void configureLegacyDNS() {
try {
// Para versiones antiguas, configuramos propiedades del sistema
System.setProperty("sun.net.inetaddr.ttl", "60");
System.setProperty("sun.net.inetaddr.negative.ttl", "10");
System.out.println("DNS legacy configurado para streaming");
} catch (Exception e) {
System.out.println("Error configurando DNS legacy: " + e.getMessage());
}
}
private static void preResolveWithGoogleDNS() {
try {
// Pre-resolver algunos dominios comunes para caching
Thread thread = new Thread(() -> {
try {
String[] domains = {"streamtp10.com", "google.com", "dns.adguard-dns.com"};
for (String domain : domains) {
try {
InetAddress.getByName(domain);
System.out.println("Pre-resuelto: " + domain);
} catch (Exception e) {
System.out.println("Error pre-resolviendo " + domain + ": " + e.getMessage());
}
}
} catch (Exception e) {
System.out.println("Error en pre-resolución: " + e.getMessage());
}
});
thread.start();
} catch (Exception e) {
System.out.println("Error en pre-resolución DNS: " + e.getMessage());
}
}
public static String getGoogleDNSInfo() {
return "DNS de Google configurado: " + String.join(", ", GOOGLE_DNS);
}
}

View File

@@ -15,7 +15,6 @@ import java.io.IOException;
import java.util.Locale;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
@@ -46,11 +45,8 @@ public class DeviceRegistry {
public DeviceRegistry(Context context) {
this.appContext = context.getApplicationContext();
this.httpClient = new OkHttpClient.Builder()
.connectTimeout(10, TimeUnit.SECONDS)
.readTimeout(15, TimeUnit.SECONDS)
.callTimeout(20, TimeUnit.SECONDS)
.build();
// Usar NetworkUtils para obtener cliente con DNS over HTTPS configurado
this.httpClient = NetworkUtils.getClient();
this.executorService = Executors.newSingleThreadExecutor();
}

View File

@@ -30,7 +30,7 @@ public class EventRepository {
private static final long CACHE_DURATION = 24L * 60 * 60 * 1000; // 24 horas
// URL única para eventos (actualizado para evitar bloqueos de ISP)
private static final String EVENTS_URL = "https://streamtp10.com/eventos.json";
private static final String EVENTS_URL = "http://streamtp10.com/eventos.json";
public interface Callback {
void onSuccess(List<EventItem> events);

View File

@@ -1,57 +1,113 @@
package com.streamplayer;
import java.security.cert.X509Certificate;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import okhttp3.Dns;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.dnsoverhttps.DnsOverHttps;
/**
* Utilidad centralizada para configuración de red con múltiples servidores DNS over HTTPS.
* Implementa fallback progresivo: Google -> Cloudflare -> AdGuard -> Quad9 -> Sistema
*/
public class NetworkUtils {
private static final OkHttpClient CLIENT;
private static final String USER_AGENT = "Mozilla/5.0 (Linux; Android 13; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36";
// URLs de servidores DNS over HTTPS
private static final String GOOGLE_DOH_URL = "https://dns.google/dns-query";
private static final String CLOUDFLARE_DOH_URL = "https://cloudflare-dns.com/dns-query";
private static final String ADGUARD_DOH_URL = "https://dns.adguard-dns.com/dns-query";
private static final String QUAD9_DOH_URL = "https://dns.quad9.net/dns-query";
static {
OkHttpClient.Builder builder = new OkHttpClient.Builder()
.connectTimeout(15, TimeUnit.SECONDS)
.readTimeout(15, TimeUnit.SECONDS)
.writeTimeout(15, TimeUnit.SECONDS)
.connectTimeout(20, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.writeTimeout(20, TimeUnit.SECONDS)
.followRedirects(true)
.followSslRedirects(true);
.followSslRedirects(true)
.retryOnConnectionFailure(true);
try {
// Configurar para aceptar todos los certificados SSL (útil para diagnosticar problemas de ISP)
// NOTA: Esto es temporal para diagnosticar si hay problemas de certificados MITM
final TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) {}
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) {}
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[]{};
}
}
};
final SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(null, trustAllCerts, new java.security.SecureRandom());
builder.sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustAllCerts[0]);
builder.hostnameVerifier((hostname, session) -> true);
// Cliente bootstrap para resolver los dominios de DNS
OkHttpClient bootstrap = new OkHttpClient.Builder()
.connectTimeout(5, TimeUnit.SECONDS)
.connectTimeout(10, TimeUnit.SECONDS)
.retryOnConnectionFailure(true)
.build();
// 1. Google DNS over HTTPS (Primario)
final DnsOverHttps googleDns = new DnsOverHttps.Builder()
.client(bootstrap)
.url(HttpUrl.get("https://dns.google/dns-query"))
.url(HttpUrl.get(GOOGLE_DOH_URL))
.bootstrapDnsHosts(
getByIp("8.8.8.8"),
getByIp("8.8.4.4"))
.includeIPv6(false)
.build();
// 2. AdGuard DNS over HTTPS (Secundario)
// 2. Cloudflare DNS over HTTPS (Secundario)
final DnsOverHttps cloudflareDns = new DnsOverHttps.Builder()
.client(bootstrap)
.url(HttpUrl.get(CLOUDFLARE_DOH_URL))
.bootstrapDnsHosts(
getByIp("1.1.1.1"),
getByIp("1.0.0.1"))
.includeIPv6(false)
.build();
// 3. AdGuard DNS over HTTPS (Terciario)
final DnsOverHttps adGuardDns = new DnsOverHttps.Builder()
.client(bootstrap)
.url(HttpUrl.get("https://dns.adguard-dns.com/dns-query"))
.url(HttpUrl.get(ADGUARD_DOH_URL))
.bootstrapDnsHosts(
getByIp("94.140.14.14"),
getByIp("94.140.15.15"))
.includeIPv6(false)
.build();
// Configurar DNS con fallback: Google -> AdGuard -> Sistema
// 4. Quad9 DNS over HTTPS (Cuaternario)
final DnsOverHttps quad9Dns = new DnsOverHttps.Builder()
.client(bootstrap)
.url(HttpUrl.get(QUAD9_DOH_URL))
.bootstrapDnsHosts(
getByIp("9.9.9.9"),
getByIp("149.112.112.112"))
.includeIPv6(false)
.build();
// Configurar DNS con fallback: Google -> Cloudflare -> AdGuard -> Quad9 -> Sistema
builder.dns(new Dns() {
@Override
public List<InetAddress> lookup(String hostname) throws UnknownHostException {
@@ -63,7 +119,15 @@ public class NetworkUtils {
// Falló Google, continuar
}
// Intento 2: AdGuard DNS
// Intento 2: Cloudflare DNS
try {
List<InetAddress> result = cloudflareDns.lookup(hostname);
if (result != null && !result.isEmpty()) return result;
} catch (Exception ignored) {
// Falló Cloudflare, continuar
}
// Intento 3: AdGuard DNS
try {
List<InetAddress> result = adGuardDns.lookup(hostname);
if (result != null && !result.isEmpty()) return result;
@@ -71,7 +135,15 @@ public class NetworkUtils {
// Falló AdGuard, continuar
}
// Intento 3: DNS del Sistema (Fallback final)
// Intento 4: Quad9 DNS
try {
List<InetAddress> result = quad9Dns.lookup(hostname);
if (result != null && !result.isEmpty()) return result;
} catch (Exception ignored) {
// Falló Quad9, continuar
}
// Intento 5: DNS del Sistema (Fallback final)
try {
return Dns.SYSTEM.lookup(hostname);
} catch (UnknownHostException e) {
@@ -82,6 +154,7 @@ public class NetworkUtils {
} catch (Exception e) {
// Si algo falla en la configuración DNS, usamos por defecto (implícito en el builder)
System.out.println("Error configurando DNS over HTTPS: " + e.getMessage());
}
CLIENT = builder.build();

View File

@@ -28,10 +28,15 @@ import androidx.media3.common.util.UnstableApi;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.security.cert.X509Certificate;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.dnsoverhttps.DnsOverHttps;
@@ -87,7 +92,7 @@ public class PlayerActivity extends AppCompatActivity {
initViews();
channelLabel.setText(channelName);
DNSSetter.configureDNSToGoogle(this);
// DNS configurado en StreamUrlResolver
loadChannel();
}
@@ -236,7 +241,7 @@ public class PlayerActivity extends AppCompatActivity {
private MediaSource buildMediaSource(MediaItem mediaItem) {
Map<String, String> headers = new HashMap<>();
headers.put("Referer", channelUrl);
headers.put("Origin", "https://streamtpcloud.com");
headers.put("Origin", "http://streamtp10.com");
headers.put("Accept", "*/*");
headers.put("Connection", "keep-alive");
@@ -254,11 +259,30 @@ public class PlayerActivity extends AppCompatActivity {
}
try {
OkHttpClient bootstrap = new OkHttpClient.Builder()
final TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) {}
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) {}
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[]{};
}
}
};
final SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(null, trustAllCerts, new java.security.SecureRandom());
OkHttpClient.Builder builder = new OkHttpClient.Builder()
.connectTimeout(20, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.retryOnConnectionFailure(true)
.build();
.sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustAllCerts[0])
.hostnameVerifier((hostname, session) -> true);
OkHttpClient bootstrap = builder.build();
DnsOverHttps dohDns = new DnsOverHttps.Builder()
.client(bootstrap)
@@ -268,10 +292,8 @@ public class PlayerActivity extends AppCompatActivity {
InetAddress.getByName("8.8.4.4"))
.build();
okHttpClient = bootstrap.newBuilder()
.dns(dohDns)
.build();
} catch (UnknownHostException e) {
okHttpClient = builder.dns(dohDns).build();
} catch (Exception e) {
okHttpClient = new OkHttpClient.Builder()
.connectTimeout(20, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)

View File

@@ -1,16 +1,25 @@
package com.streamplayer;
import java.io.IOException;
import java.net.InetAddress;
import java.security.cert.X509Certificate;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.dnsoverhttps.DnsOverHttps;
/**
* Resuelve la URL real del stream extrayendo playbackURL de la página.
* Utiliza NetworkUtils para configuración centralizada de DNS.
* Utiliza DNS de Google para evitar bloqueos.
*/
public final class StreamUrlResolver {
@@ -18,6 +27,61 @@ public final class StreamUrlResolver {
private static final Pattern PLAYBACK_URL_PATTERN =
Pattern.compile("var\\s+playbackURL\\s*=\\s*[\"']([^\"']+)[\"']");
private static final String USER_AGENT = "Mozilla/5.0 (Linux; Android 13; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36";
private static final OkHttpClient CLIENT;
static {
OkHttpClient client = null;
try {
final TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) {}
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) {}
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[]{};
}
}
};
final SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(null, trustAllCerts, new java.security.SecureRandom());
OkHttpClient.Builder builder = new OkHttpClient.Builder()
.connectTimeout(15, TimeUnit.SECONDS)
.readTimeout(15, TimeUnit.SECONDS)
.followRedirects(true)
.sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustAllCerts[0])
.hostnameVerifier((hostname, session) -> true);
OkHttpClient bootstrap = new OkHttpClient.Builder()
.sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustAllCerts[0])
.hostnameVerifier((hostname, session) -> true)
.build();
DnsOverHttps dns = new DnsOverHttps.Builder()
.client(bootstrap)
.url(HttpUrl.get("https://dns.google/dns-query"))
.bootstrapDnsHosts(
InetAddress.getByName("8.8.8.8"),
InetAddress.getByName("8.8.4.4"))
.build();
builder.dns(dns);
client = builder.build();
} catch (Exception e) {
client = new OkHttpClient.Builder()
.connectTimeout(15, TimeUnit.SECONDS)
.readTimeout(15, TimeUnit.SECONDS)
.followRedirects(true)
.build();
}
CLIENT = client;
}
private StreamUrlResolver() {
}
@@ -41,13 +105,13 @@ public final class StreamUrlResolver {
private static String downloadPage(String pageUrl) throws IOException {
Request request = new Request.Builder()
.url(pageUrl)
.header("User-Agent", NetworkUtils.getUserAgent())
.header("User-Agent", USER_AGENT)
.header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
.header("Accept-Language", "es-ES,es;q=0.9,en;q=0.8")
.header("Referer", "https://streamtp10.com/")
.header("Referer", "http://streamtp10.com/")
.build();
try (Response response = NetworkUtils.getClient().newCall(request).execute()) {
try (Response response = CLIENT.newCall(request).execute()) {
if (!response.isSuccessful()) {
throw new IOException("Error HTTP " + response.code() + " al cargar la página del stream");
}

View File

@@ -31,10 +31,10 @@ import java.lang.ref.WeakReference;
import java.util.Locale;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Request;
import okhttp3.Response;
/**
@@ -63,11 +63,8 @@ public class UpdateManager {
this.appContext = context.getApplicationContext();
this.mainHandler = new Handler(Looper.getMainLooper());
this.networkExecutor = Executors.newSingleThreadExecutor();
this.httpClient = new OkHttpClient.Builder()
.connectTimeout(15, TimeUnit.SECONDS)
.readTimeout(20, TimeUnit.SECONDS)
.callTimeout(25, TimeUnit.SECONDS)
.build();
// Usar NetworkUtils para obtener cliente con DNS over HTTPS configurado
this.httpClient = NetworkUtils.getClient();
}
public void checkForUpdates(UpdateCallback callback) {

View File

@@ -1,10 +1,10 @@
{
"versionCode": 100300,
"versionName": "10.0.3",
"minSupportedVersionCode": 91000,
"versionCode": 100110,
"versionName": "10.1.10",
"minSupportedVersionCode": 0,
"forceUpdate": false,
"downloadUrl": "https://gitea.cbcren.online/renato97/app/releases/download/v10.0.3/StreamPlayer-v10.0.3.apk",
"fileName": "StreamPlayer-v10.0.3.apk",
"sizeBytes": 0,
"notes": "StreamPlayer v10.0.3\n\nNovedades:\n- Fix: Evasión de bloqueos regionales mediante DNS de Google (DoH)\n- Corrección de error 'No se encontró la clave del stream'"
}
"downloadUrl": "http://gitea.cbcren.online/renato97/app/releases/download/v10.1.10/StreamPlayer-v10.1.10-debug.apk",
"fileName": "StreamPlayer-v10.1.10-debug.apk",
"sizeBytes": 9113609,
"notes": "Cambiar a HTTP para evitar errores de certificado"
}