Update xc
This commit is contained in:
parent
070285a32d
commit
7b76dc4523
|
|
@ -6,29 +6,41 @@ import com.google.gson.annotations.SerializedName;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import okhttp3.HttpUrl;
|
||||||
|
|
||||||
public class Config {
|
public class Config {
|
||||||
|
|
||||||
@SerializedName("name")
|
|
||||||
private String name;
|
|
||||||
@SerializedName("pass")
|
|
||||||
private String pass;
|
|
||||||
@SerializedName("vod")
|
@SerializedName("vod")
|
||||||
private boolean vod;
|
private boolean vod;
|
||||||
|
@SerializedName("live")
|
||||||
|
private boolean live;
|
||||||
@SerializedName("formats")
|
@SerializedName("formats")
|
||||||
private List<String> formats;
|
private List<String> formats;
|
||||||
|
|
||||||
private String url;
|
private HttpUrl url;
|
||||||
|
private String name;
|
||||||
|
private String pass;
|
||||||
|
|
||||||
public static Config objectFrom(String str) {
|
public static Config objectFrom(String str) {
|
||||||
Config item = new Gson().fromJson(str, Config.class);
|
Config item = new Gson().fromJson(str, Config.class);
|
||||||
return item == null ? new Config() : item;
|
return item == null ? new Config() : item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUrl(String url) {
|
public boolean isVod() {
|
||||||
this.url = url;
|
return vod;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUrl() {
|
public boolean isLive() {
|
||||||
|
return live;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = HttpUrl.parse(url);
|
||||||
|
setName(this.url.queryParameter("username"));
|
||||||
|
setPass(this.url.queryParameter("password"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public HttpUrl getUrl() {
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -36,12 +48,16 @@ public class Config {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
public String getPass() {
|
public String getPass() {
|
||||||
return pass;
|
return pass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVod() {
|
public void setPass(String pass) {
|
||||||
return vod;
|
this.pass = pass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getFormats() {
|
public List<String> getFormats() {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package com.github.catvod.bean.xtream;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import com.github.catvod.spider.XtreamCode;
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
@ -12,6 +11,8 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import okhttp3.HttpUrl;
|
||||||
|
|
||||||
public class XStream {
|
public class XStream {
|
||||||
|
|
||||||
@SerializedName("name")
|
@SerializedName("name")
|
||||||
|
|
@ -65,8 +66,12 @@ public class XStream {
|
||||||
|
|
||||||
public List<String> getPlayUrl(Config config) {
|
public List<String> getPlayUrl(Config config) {
|
||||||
List<String> urls = new ArrayList<>();
|
List<String> urls = new ArrayList<>();
|
||||||
if (!getContainerExtension().isEmpty()) urls.add(XtreamCode.getBuilder(config).addPathSegment(getStreamType()).addPathSegment(config.getName()).addPathSegment(config.getPass()).addPathSegment(getStreamId() + "." + getContainerExtension()).build().toString());
|
if (!getContainerExtension().isEmpty()) urls.add(getBuilder(config).addPathSegment(getStreamType()).addPathSegment(config.getName()).addPathSegment(config.getPass()).addPathSegment(getStreamId() + "." + getContainerExtension()).build().toString());
|
||||||
else for (String format : config.getFormats()) urls.add(XtreamCode.getBuilder(config).addPathSegment(getStreamType()).addPathSegment(config.getName()).addPathSegment(config.getPass()).addPathSegment(getStreamId() + "." + format + "$" + format.toUpperCase()).build().toString());
|
else for (String format : config.getFormats()) urls.add(getBuilder(config).addPathSegment(getStreamType()).addPathSegment(config.getName()).addPathSegment(config.getPass()).addPathSegment(getStreamId() + "." + format + "$" + format.toUpperCase()).build().toString());
|
||||||
return urls;
|
return urls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private HttpUrl.Builder getBuilder(Config config) {
|
||||||
|
return new HttpUrl.Builder().scheme(config.getUrl().scheme()).host(config.getUrl().host()).port(config.getUrl().port());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,6 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import okhttp3.HttpUrl;
|
|
||||||
|
|
||||||
public class XtreamCode extends Spider {
|
public class XtreamCode extends Spider {
|
||||||
|
|
||||||
private List<Group> groups;
|
private List<Group> groups;
|
||||||
|
|
@ -32,6 +30,12 @@ public class XtreamCode extends Spider {
|
||||||
@Override
|
@Override
|
||||||
public String liveContent(String url) {
|
public String liveContent(String url) {
|
||||||
config.setUrl(url);
|
config.setUrl(url);
|
||||||
|
setChannel();
|
||||||
|
setNumber();
|
||||||
|
return new Gson().toJson(groups);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setChannel() {
|
||||||
List<XCategory> categoryList = getCategoryList(config);
|
List<XCategory> categoryList = getCategoryList(config);
|
||||||
List<XStream> streamList = getStreamList(config);
|
List<XStream> streamList = getStreamList(config);
|
||||||
Map<String, String> categoryMap = new HashMap<>();
|
Map<String, String> categoryMap = new HashMap<>();
|
||||||
|
|
@ -46,22 +50,19 @@ public class XtreamCode extends Spider {
|
||||||
if (!stream.getEpgChannelId().isEmpty()) channel.setTvgName(stream.getEpgChannelId());
|
if (!stream.getEpgChannelId().isEmpty()) channel.setTvgName(stream.getEpgChannelId());
|
||||||
channel.getUrls().addAll(stream.getPlayUrl(config));
|
channel.getUrls().addAll(stream.getPlayUrl(config));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setNumber() {
|
||||||
int number = 0;
|
int number = 0;
|
||||||
for (Group group : groups) {
|
for (Group group : groups) {
|
||||||
for (Channel channel : group.getChannel()) {
|
for (Channel channel : group.getChannel()) {
|
||||||
if (channel.getNumber().isEmpty()) channel.setNumber(++number);
|
if (channel.getNumber().isEmpty()) channel.setNumber(++number);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Gson().toJson(groups);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HttpUrl.Builder getBuilder(Config config) {
|
|
||||||
HttpUrl url = HttpUrl.parse(config.getUrl());
|
|
||||||
return new HttpUrl.Builder().scheme(url.scheme()).host(url.host()).port(url.port());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getApiUrl(Config config, String action) {
|
private String getApiUrl(Config config, String action) {
|
||||||
return getBuilder(config).addPathSegment("player_api.php").addQueryParameter("username", config.getName()).addQueryParameter("password", config.getPass()).addQueryParameter("action", action).build().toString();
|
return config.getUrl().newBuilder().addQueryParameter("action", action).build().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<XCategory> getLiveCategoryList(Config config) {
|
private List<XCategory> getLiveCategoryList(Config config) {
|
||||||
|
|
@ -81,13 +82,15 @@ public class XtreamCode extends Spider {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<XCategory> getCategoryList(Config config) {
|
private List<XCategory> getCategoryList(Config config) {
|
||||||
List<XCategory> categoryList = getLiveCategoryList(config);
|
List<XCategory> categoryList = new ArrayList<>();
|
||||||
|
if (config.isLive()) categoryList.addAll(getLiveCategoryList(config));
|
||||||
if (config.isVod()) categoryList.addAll(getVodCategoryList(config));
|
if (config.isVod()) categoryList.addAll(getVodCategoryList(config));
|
||||||
return categoryList;
|
return categoryList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<XStream> getStreamList(Config config) {
|
private List<XStream> getStreamList(Config config) {
|
||||||
List<XStream> streamList = getLiveStreamList(config);
|
List<XStream> streamList = new ArrayList<>();
|
||||||
|
if (config.isLive()) streamList.addAll(getLiveStreamList(config));
|
||||||
if (config.isVod()) streamList.addAll(getVodStreamList(config));
|
if (config.isVod()) streamList.addAll(getVodStreamList(config));
|
||||||
return streamList;
|
return streamList;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
0e8190a0e9fb28163c19789d2f3642fa
|
5e53c8f9ddd4ede5359c16bee091db93
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,12 @@
|
||||||
{
|
{
|
||||||
"name": "XtreamCode",
|
"name": "XtreamCode",
|
||||||
"api": "csp_XtreamCode",
|
"api": "csp_XtreamCode",
|
||||||
"url": "http://iptv.icsnleb.com:25461/",
|
"url": "http://iptv.icsnleb.com:25461/player_api.php?username=12&password=12",
|
||||||
"epg": "http://iptv.icsnleb.com:25461/xmltv.php?username=12&password=12",
|
"epg": "http://iptv.icsnleb.com:25461/xmltv.php?username=12&password=12",
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"ext": {
|
"ext": {
|
||||||
"name": "12",
|
"live": true,
|
||||||
"pass": "12",
|
"vod": true,
|
||||||
"vod": false,
|
|
||||||
"formats": [
|
"formats": [
|
||||||
"m3u8",
|
"m3u8",
|
||||||
"ts"
|
"ts"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue