6 Commits

Author SHA1 Message Date
renato97
5bd1a2737d Feature: Enable in-app updates for private repository
- Added Gitea API token authentication to UpdateManager
- Now can check releases from private repository
- Bumped version to 10.0.5
2026-01-26 22:08:51 +01:00
renato97
e3aafd3290 Fix: Updated StreamUrlResolver for new page structure
- Page no longer uses obfuscated JavaScript
- playbackURL is now directly in HTML
- Simplified extraction using regex
- Bumped version to 10.0.4
2026-01-26 22:02:43 +01:00
renato97
b6612c4544 Fix: Bypass regional blocks using Google DNS (DoH)
- Updated StreamUrlResolver to use OkHttp with Google DoH
- Updated PlayerActivity to use Google DoH (8.8.8.8)
- Bumped version to 10.0.3
2026-01-26 21:59:05 +01:00
renato97
df296d7172 Update: Use new domain streamtpcloud.com for events and streams
- Updated EventRepository to point to streamtpcloud.com/eventos.json
- Updated ChannelRepository URLs to streamtpcloud.com
- Updated PlayerActivity Origin header
- Bumped version to 10.0.2
2026-01-26 21:53:56 +01:00
renato97
bac564eb4f Fix: Crash on HTML response in EventRepository and others
- Fixed: Value <! DOCTYPE cannot be converted to JSONArray in EventRepository
- Fixed: Added HTML validation in UpdateManager and DeviceRegistry
- Fixed: Improved HTTP error handling in StreamUrlResolver
- Improved: Error messages in PlayerActivity
- Bumped version to 9.4.3
2026-01-26 21:48:02 +01:00
ren
05625ffe50 Update manifest with v10.0 download URL 2026-01-12 00:36:26 +01:00
10 changed files with 486 additions and 200 deletions

View File

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

View File

@@ -81,6 +81,15 @@ public class DeviceRegistry {
throw new IOException("HTTP " + response.code());
}
String responseText = response.body().string();
// Validar que no sea HTML antes de parsear
if (responseText != null) {
String trimmed = responseText.trim();
if (trimmed.startsWith("<!") || trimmed.startsWith("<html")) {
throw new IOException("El servidor devolvió HTML en lugar de JSON");
}
}
JSONObject json = new JSONObject(responseText);
JSONObject deviceJson = json.optJSONObject("device");
JSONObject verificationJson = json.optJSONObject("verification");

View File

@@ -30,7 +30,7 @@ public class EventRepository {
private static final String KEY_JSON = "json";
private static final String KEY_TIMESTAMP = "timestamp";
private static final long CACHE_DURATION = 24L * 60 * 60 * 1000; // 24 horas
private static final String EVENTS_URL = "https://streamtpmedia.com/eventos.json";
private static final String EVENTS_URL = "https://streamtpcloud.com/eventos.json";
public interface Callback {
void onSuccess(List<EventItem> events);
@@ -79,19 +79,52 @@ public class EventRepository {
connection.setConnectTimeout(15000);
connection.setReadTimeout(15000);
connection.setRequestMethod("GET");
try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {
StringBuilder builder = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
connection.setRequestProperty("Accept", "application/json");
connection.setRequestProperty("User-Agent", "StreamPlayer/1.0");
try {
int responseCode = connection.getResponseCode();
if (responseCode != HttpURLConnection.HTTP_OK) {
throw new IOException("Error HTTP " + responseCode + ": " + connection.getResponseMessage());
}
String contentType = connection.getContentType();
// Permitir json o text/plain (Raw de Gitea a veces es text/plain)
if (contentType != null && !contentType.contains("json") && !contentType.contains("text/plain")) {
throw new IOException("El servidor devolvió " + contentType + " en lugar de JSON. Verifica que la URL sea correcta.");
}
try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {
StringBuilder builder = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
}
String response = builder.toString();
// Validar que no sea HTML
if (response.trim().startsWith("<!") || response.trim().startsWith("<html")) {
throw new IOException("El servidor devolvió HTML en lugar de JSON. La URL del endpoint puede estar incorrecta o el servidor tiene problemas.");
}
return response;
}
return builder.toString();
} finally {
connection.disconnect();
}
}
private List<EventItem> parseEvents(String json) throws JSONException {
if (json == null || json.trim().isEmpty()) {
throw new JSONException("La respuesta está vacía");
}
// Validar que no sea HTML antes de parsear
String trimmed = json.trim();
if (trimmed.startsWith("<!") || trimmed.startsWith("<html")) {
throw new JSONException("Se recibió HTML en lugar de JSON");
}
JSONArray array = new JSONArray(json);
List<EventItem> events = new ArrayList<>();
for (int i = 0; i < array.length(); i++) {
@@ -112,7 +145,8 @@ public class EventRepository {
if (link == null) {
return "";
}
return link.replace("global1.php", "global2.php");
String updated = link.replace("streamtpmedia.com", "streamtpcloud.com");
return updated.replace("global1.php", "global2.php");
}
private String extractChannelName(String link) {

View File

@@ -22,6 +22,7 @@ import com.google.android.exoplayer2.source.hls.HlsMediaSource;
import com.google.android.exoplayer2.ui.PlayerView;
import com.google.android.exoplayer2.util.Util;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.HashMap;
@@ -100,8 +101,10 @@ public class PlayerActivity extends AppCompatActivity {
try {
String resolvedUrl = StreamUrlResolver.resolve(channelUrl);
runOnUiThread(() -> startPlayback(resolvedUrl));
} catch (IOException e) {
runOnUiThread(() -> showError("No se pudo conectar con el canal: " + e.getMessage()));
} catch (Exception e) {
runOnUiThread(() -> showError("Error al obtener stream: " + e.getMessage()));
runOnUiThread(() -> showError("Error inesperado: " + e.getMessage()));
}
}).start();
}
@@ -174,7 +177,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://streamtpmedia.com");
headers.put("Origin", "https://streamtpcloud.com");
headers.put("Accept", "*/*");
headers.put("Connection", "keep-alive");
@@ -200,10 +203,10 @@ public class PlayerActivity extends AppCompatActivity {
DnsOverHttps dohDns = new DnsOverHttps.Builder()
.client(bootstrap)
.url(HttpUrl.get("https://dns.adguard-dns.com/dns-query"))
.url(HttpUrl.get("https://dns.google/dns-query"))
.bootstrapDnsHosts(
InetAddress.getByName("94.140.14.14"),
InetAddress.getByName("94.140.15.15"))
InetAddress.getByName("8.8.8.8"),
InetAddress.getByName("8.8.4.4"))
.build();
okHttpClient = bootstrap.newBuilder()

View File

@@ -1,132 +1,94 @@
package com.streamplayer;
import android.util.Base64;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.dnsoverhttps.DnsOverHttps;
/**
* Resuelve la URL real del stream analizando el JavaScript ofuscado de streamtpmedia.
* Resuelve la URL real del stream extrayendo playbackURL de la página.
* Utiliza DNS de Google para evitar bloqueos.
*/
public final class StreamUrlResolver {
private static final Pattern ARRAY_NAME_PATTERN =
Pattern.compile("var\\s+playbackURL\\s*=\\s*\"\"\\s*,\\s*([A-Za-z0-9]+)\\s*=\\s*\\[\\]");
private static final Pattern ENTRY_PATTERN = Pattern.compile("\\[(\\d+),\"([A-Za-z0-9+/=]+)\"\\]");
private static final Pattern KEY_FUNCTIONS_PATTERN = Pattern.compile("var\\s+k=(\\w+)\\(\\)\\+(\\w+)\\(\\);");
private static final String FUNCTION_TEMPLATE = "function\\s+%s\\(\\)\\s*\\{\\s*return\\s+(\\d+);\\s*\\}";
private static final String USER_AGENT = "Mozilla/5.0 (Linux; Android 13) ExoPlayerResolver/1.0";
// Patrón para extraer la URL del stream directamente
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.Builder builder = new OkHttpClient.Builder()
.connectTimeout(15, TimeUnit.SECONDS)
.readTimeout(15, TimeUnit.SECONDS)
.followRedirects(true);
try {
// DNS de Google (8.8.8.8)
OkHttpClient bootstrap = new OkHttpClient.Builder().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);
} catch (UnknownHostException e) {
// Fallback a DNS del sistema
}
CLIENT = builder.build();
}
private StreamUrlResolver() {
}
public static String resolve(String pageUrl) throws IOException {
String html = downloadPage(pageUrl);
long keyOffset = extractKeyOffset(html);
List<Entry> entries = extractEntries(html);
if (entries.isEmpty()) {
throw new IOException("No se pudieron obtener los fragmentos del stream");
// Buscar playbackURL directamente en el HTML
Matcher matcher = PLAYBACK_URL_PATTERN.matcher(html);
if (matcher.find()) {
String url = matcher.group(1);
if (url != null && !url.isEmpty() && url.startsWith("http")) {
return url;
}
}
StringBuilder builder = new StringBuilder();
for (Entry entry : entries) {
String decoded = new String(Base64.decode(entry.encoded, Base64.DEFAULT), StandardCharsets.UTF_8);
String numeric = decoded.replaceAll("\\D+", "");
if (numeric.isEmpty()) {
continue;
}
long value = Long.parseLong(numeric) - keyOffset;
builder.append((char) value);
}
String url = builder.toString();
if (url.isEmpty()) {
throw new IOException("No se pudo reconstruir la URL del stream");
}
return url;
// Si no encontramos la URL, mostrar un fragmento del HTML para debug
String preview = html.length() > 500 ? html.substring(0, 500) : html;
throw new IOException("No se encontró la URL del stream en la página. Vista previa: " + preview);
}
private static String downloadPage(String pageUrl) throws IOException {
HttpURLConnection connection = (HttpURLConnection) new URL(pageUrl).openConnection();
connection.setConnectTimeout(15000);
connection.setReadTimeout(15000);
connection.setRequestProperty("User-Agent", USER_AGENT);
connection.setRequestProperty("Accept", "text/html,application/xhtml+xml");
connection.connect();
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {
StringBuilder builder = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
Request request = new Request.Builder()
.url(pageUrl)
.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://streamtpcloud.com/")
.build();
try (Response response = CLIENT.newCall(request).execute()) {
if (!response.isSuccessful()) {
throw new IOException("Error HTTP " + response.code() + " al cargar la página del stream");
}
if (response.body() == null) {
throw new IOException("Respuesta vacía del servidor");
}
return builder.toString();
} finally {
connection.disconnect();
}
}
private static long extractKeyOffset(String html) throws IOException {
Matcher matcher = KEY_FUNCTIONS_PATTERN.matcher(html);
if (!matcher.find()) {
throw new IOException("No se encontró la clave del stream");
}
String first = matcher.group(1);
String second = matcher.group(2);
long firstVal = extractReturnValue(html, first);
long secondVal = extractReturnValue(html, second);
return firstVal + secondVal;
}
private static long extractReturnValue(String html, String functionName) throws IOException {
Pattern functionPattern = Pattern.compile(
String.format(FUNCTION_TEMPLATE, Pattern.quote(functionName)));
Matcher matcher = functionPattern.matcher(html);
if (!matcher.find()) {
throw new IOException("No se encontró el valor de la función " + functionName);
}
return Long.parseLong(matcher.group(1));
}
private static List<Entry> extractEntries(String html) throws IOException {
Matcher arrayNameMatcher = ARRAY_NAME_PATTERN.matcher(html);
if (!arrayNameMatcher.find()) {
throw new IOException("No se detectó la variable del arreglo de fragmentos");
}
String arrayName = arrayNameMatcher.group(1);
Pattern arrayPattern = Pattern.compile(Pattern.quote(arrayName) + "=\\[(.*?)\\];", Pattern.DOTALL);
Matcher matcher = arrayPattern.matcher(html);
if (!matcher.find()) {
throw new IOException("No se encontró el arreglo de fragmentos");
}
String rawEntries = matcher.group(1);
Matcher entryMatcher = ENTRY_PATTERN.matcher(rawEntries);
List<Entry> entries = new ArrayList<>();
while (entryMatcher.find()) {
int index = Integer.parseInt(entryMatcher.group(1));
String encoded = entryMatcher.group(2);
entries.add(new Entry(index, encoded));
}
Collections.sort(entries, Comparator.comparingInt(e -> e.index));
return entries;
}
private static final class Entry {
final int index;
final String encoded;
Entry(int index, String encoded) {
this.index = index;
this.encoded = encoded;
return response.body().string();
}
}
}

View File

@@ -45,6 +45,7 @@ public class UpdateManager {
private static final String TAG = "UpdateManager";
private static final String LATEST_RELEASE_URL =
"https://gitea.cbcren.online/api/v1/repos/renato97/app/releases/latest";
private static final String GITEA_TOKEN = "4b94b3610136529861af0821040a801906821a0f";
private final Context appContext;
private final Handler mainHandler;
@@ -74,6 +75,7 @@ public class UpdateManager {
try {
Request request = new Request.Builder()
.url(LATEST_RELEASE_URL)
.header("Authorization", "token " + GITEA_TOKEN)
.get()
.build();
try (Response response = httpClient.newCall(request).execute()) {
@@ -172,6 +174,16 @@ public class UpdateManager {
}
private UpdateInfo parseRelease(String responseBody) throws JSONException, IOException {
if (responseBody == null || responseBody.trim().isEmpty()) {
throw new JSONException("La respuesta está vacía");
}
// Validar que no sea HTML antes de parsear
String trimmed = responseBody.trim();
if (trimmed.startsWith("<!") || trimmed.startsWith("<html")) {
throw new JSONException("Se recibió HTML en lugar de JSON");
}
JSONObject releaseJson = new JSONObject(responseBody);
String tagName = releaseJson.optString("tag_name", "");
String versionName = deriveVersionName(tagName, releaseJson.optString("name"));
@@ -237,13 +249,22 @@ public class UpdateManager {
if (TextUtils.isEmpty(url)) {
continue;
}
Request request = new Request.Builder().url(url).get().build();
Request request = new Request.Builder()
.url(url)
.header("Authorization", "token " + GITEA_TOKEN)
.get()
.build();
try (Response response = httpClient.newCall(request).execute()) {
if (!response.isSuccessful() || response.body() == null) {
continue;
}
String json = response.body().string();
if (!TextUtils.isEmpty(json)) {
// Validar que no sea HTML antes de parsear
String trimmed = json.trim();
if (trimmed.startsWith("<!") || trimmed.startsWith("<html")) {
continue;
}
return new JSONObject(json);
}
}

View File

@@ -6,13 +6,13 @@
"model": "SM-S928B",
"manufacturer": "Samsung",
"osVersion": "16 (API 36)",
"appVersionName": "9.4.1",
"appVersionCode": 94100,
"appVersionName": "9.4.2",
"appVersionCode": 94200,
"firstSeen": "2025-11-23T22:31:13.359Z",
"lastSeen": "2025-11-23T23:11:07.215Z",
"lastSeen": "2025-11-25T19:07:38.445Z",
"blocked": false,
"notes": "",
"installs": 7,
"installs": 22,
"ip": "181.23.253.20",
"country": "AR",
"verification": {
@@ -22,5 +22,246 @@
"createdAt": "2025-11-23T22:31:13.359Z",
"verifiedAt": "2025-11-23T22:33:11.942Z"
}
},
{
"deviceId": "c8ee9361c07a3245",
"alias": "",
"deviceName": "23113RKC6G",
"model": "23113RKC6G",
"manufacturer": "Xiaomi",
"osVersion": "15 (API 35)",
"appVersionName": "9.4.2",
"appVersionCode": 94200,
"firstSeen": "2025-11-23T23:19:29.464Z",
"lastSeen": "2025-11-23T23:21:02.377Z",
"blocked": false,
"notes": "",
"installs": 3,
"ip": "181.23.253.20",
"country": "AR",
"verification": {
"clientPart": "f7d5a364822457da",
"adminPart": "b4acb7da77b11ce9",
"status": "verified",
"createdAt": "2025-11-23T23:19:29.464Z",
"verifiedAt": "2025-11-23T23:20:49.579Z"
}
},
{
"deviceId": "c874876530da8f76",
"alias": "",
"deviceName": "2020/2021 UHD Android TV",
"model": "2020/2021 UHD Android TV",
"manufacturer": "TPV",
"osVersion": "11 (API 30)",
"appVersionName": "9.4.2",
"appVersionCode": 94200,
"firstSeen": "2025-11-24T18:53:40.668Z",
"lastSeen": "2025-11-25T01:33:56.790Z",
"blocked": false,
"notes": "",
"installs": 3,
"ip": "181.23.253.20",
"country": "AR",
"verification": {
"clientPart": "76139a364baeda9b",
"adminPart": "86601e7089416b57",
"status": "verified",
"createdAt": "2025-11-24T18:53:40.668Z",
"verifiedAt": "2025-11-24T18:54:52.788Z"
}
},
{
"deviceId": "879fe5ad6ac80e2d",
"alias": "",
"deviceName": "SM-S928B",
"model": "SM-S928B",
"manufacturer": "Samsung",
"osVersion": "16 (API 36)",
"appVersionName": "9.4.6",
"appVersionCode": 94600,
"firstSeen": "2025-11-25T19:08:38.948Z",
"lastSeen": "2025-12-23T20:41:59.972Z",
"blocked": false,
"notes": "",
"installs": 9,
"ip": "181.23.228.93",
"country": "AR",
"verification": {
"clientPart": "e512eb7d5c026e85",
"adminPart": "1891c4eec608a722",
"status": "verified",
"createdAt": "2025-11-25T19:08:38.948Z",
"verifiedAt": "2025-11-25T19:08:56.806Z"
}
},
{
"deviceId": "97a5c320c47e17ad",
"alias": "",
"deviceName": "Chromecast",
"model": "Chromecast",
"manufacturer": "Google",
"osVersion": "14 (API 34)",
"appVersionName": "9.4.6",
"appVersionCode": 94600,
"firstSeen": "2025-11-25T19:10:27.358Z",
"lastSeen": "2025-12-29T23:21:36.891Z",
"blocked": false,
"notes": "",
"installs": 26,
"ip": "181.23.228.93",
"country": "AR",
"verification": {
"clientPart": "f35ae98e27e9877c",
"adminPart": "e421a660ff38fc67",
"status": "verified",
"createdAt": "2025-11-25T19:10:27.358Z",
"verifiedAt": "2025-11-25T19:10:54.592Z"
}
},
{
"deviceId": "79a556d89cd9f783",
"alias": "",
"deviceName": "motorola edge 30",
"model": "motorola edge 30",
"manufacturer": "Motorola",
"osVersion": "13 (API 33)",
"appVersionName": "9.4.6",
"appVersionCode": 94600,
"firstSeen": "2025-11-25T19:29:17.916Z",
"lastSeen": "2025-12-14T20:26:50.664Z",
"blocked": false,
"notes": "",
"installs": 5,
"ip": "181.25.52.139",
"country": "AR",
"verification": {
"clientPart": "4aec5b0e2e1c782a",
"adminPart": "7a4bb228e3b5048c",
"status": "verified",
"createdAt": "2025-11-25T19:29:17.916Z",
"verifiedAt": "2025-11-25T19:30:11.849Z"
}
},
{
"deviceId": "309f9f56550fc16bf047d636",
"alias": "",
"deviceName": "WIN-J7S53EBK2BG",
"model": "Microsoft Windows 10.0.26100",
"manufacturer": "Microsoft",
"osVersion": "Microsoft Windows NT 10.0.26100.0",
"appVersionName": "9.4.6",
"appVersionCode": 94600,
"firstSeen": "2025-12-17T18:37:45.562Z",
"lastSeen": "2025-12-17T19:28:44.530Z",
"blocked": false,
"notes": "por boludo",
"installs": 21,
"ip": "181.25.52.139",
"country": "AR",
"verification": {
"clientPart": "60989c16f0ed61d9",
"adminPart": "c1befd758b4cd459",
"status": "verified",
"createdAt": "2025-12-17T18:37:45.562Z",
"verifiedAt": "2025-12-17T18:38:24.129Z"
},
"blockedAt": "2025-12-17T19:14:30.701Z"
},
{
"deviceId": "12c96524b10b1e15f5611b0a",
"alias": "",
"deviceName": "WIN-1F1PBAQI7PR",
"model": "Microsoft Windows 10.0.26100",
"manufacturer": "Microsoft",
"osVersion": "Microsoft Windows NT 10.0.26100.0",
"appVersionName": "9.4.6",
"appVersionCode": 94600,
"firstSeen": "2025-12-17T19:35:44.810Z",
"lastSeen": "2025-12-17T19:38:12.510Z",
"blocked": false,
"notes": "",
"installs": 2,
"ip": "181.25.52.139",
"country": "AR",
"verification": {
"clientPart": "d41b6a6bc639fe77",
"adminPart": "dab1fa74da2edab2",
"status": "verified",
"createdAt": "2025-12-17T19:35:44.810Z",
"verifiedAt": "2025-12-17T19:37:59.152Z"
}
},
{
"deviceId": "6623a19316ebbbc1570b31e2",
"alias": "",
"deviceName": "DESKTOP-TF8OENP",
"model": "Microsoft Windows 10.0.19045",
"manufacturer": "Microsoft",
"osVersion": "Microsoft Windows NT 10.0.19045.0",
"appVersionName": "9.4.6",
"appVersionCode": 94600,
"firstSeen": "2025-12-17T19:53:20.007Z",
"lastSeen": "2025-12-17T19:56:52.028Z",
"blocked": false,
"notes": "",
"installs": 4,
"ip": "190.55.131.98",
"country": "AR",
"verification": {
"clientPart": "e5ed2a5989a8e44a",
"adminPart": "21e79e6e83e662cf",
"status": "verified",
"createdAt": "2025-12-17T19:53:20.007Z",
"verifiedAt": "2025-12-17T19:53:43.017Z"
}
},
{
"deviceId": "8678935B-0B7A-41B0-B6E3-AB205073BE7F",
"alias": "",
"deviceName": "iPhone 17 Pro",
"model": "iPhone",
"manufacturer": "Apple",
"osVersion": "iOS 26.2",
"appVersionName": "9.4.2",
"appVersionCode": 94200,
"firstSeen": "2025-12-29T22:27:06.203Z",
"lastSeen": "2025-12-29T22:36:32.797Z",
"blocked": false,
"notes": "",
"installs": 3,
"ip": "181.23.228.93",
"country": "AR",
"verification": {
"clientPart": "fac4063d6b67ce57",
"adminPart": "667b10f28d37b534",
"status": "verified",
"createdAt": "2025-12-29T22:27:06.203Z",
"verifiedAt": "2025-12-29T22:30:37.120Z"
}
},
{
"deviceId": "FB4B39C0-A766-4A01-980E-763ACE9118A2",
"alias": "",
"deviceName": "iPhone 17 Pro",
"model": "iPhone",
"manufacturer": "Apple",
"osVersion": "iOS 26.2",
"appVersionName": "9.4.2",
"appVersionCode": 94200,
"firstSeen": "2025-12-29T22:40:54.202Z",
"lastSeen": "2025-12-29T23:04:30.334Z",
"blocked": false,
"notes": "",
"installs": 4,
"ip": "181.23.228.93",
"country": "AR",
"verification": {
"clientPart": "353df62e6d1faee3",
"adminPart": "648bd37e530033f7",
"status": "verified",
"createdAt": "2025-12-29T22:40:54.202Z",
"verifiedAt": "2025-12-29T22:44:27.529Z"
}
}
]

16
eventos.json Normal file
View File

@@ -0,0 +1,16 @@
[
{
"title": "Partido de Prueba",
"time": "22:00",
"category": "Fútbol",
"status": "EN VIVO",
"link": "https://streamtpmedia.com/global2.php?stream=espn"
},
{
"title": "Canal Deportivo",
"time": "15:30",
"category": "Deportes",
"status": "PRÓXIMO",
"link": "https://streamtpmedia.com/global2.php?stream=foxsports"
}
]

View File

@@ -1,10 +1,10 @@
{
"versionCode": 100000,
"versionName": "10.0",
"versionCode": 100300,
"versionName": "10.0.3",
"minSupportedVersionCode": 91000,
"forceUpdate": false,
"downloadUrl": "https://gitea.cbcren.online/renato97/app/releases/download/v10.0/StreamPlayer-v10.0.apk",
"fileName": "StreamPlayer-v10.0.apk",
"sizeBytes": 16674,
"notes": "StreamPlayer v10.0\n\nNueva versión mayor:\n\n- Actualización a versión 10.0\n- Versión estable con todas las características previas\n- Sistema de actualizaciones automáticas activado\n- Mejoras de rendimiento y estabilidad general\n\nEsta versión marca un hito importante en el desarrollo de StreamPlayer, consolidando todas las mejoras implementadas en versiones anteriores."
"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'"
}