New live format
This commit is contained in:
parent
e01b77c6f3
commit
0e31899ebe
|
|
@ -6,7 +6,15 @@
|
||||||
"name": "直播",
|
"name": "直播",
|
||||||
"type": 0,
|
"type": 0,
|
||||||
"url": "http://home.jundie.top:81/Cat/tv/live.txt",
|
"url": "http://home.jundie.top:81/Cat/tv/live.txt",
|
||||||
"epg": "https://epg.112114.xyz/?ch={name}&date={date}"
|
"epg": "https://epg.112114.xyz/?ch={name}&date={date}",
|
||||||
|
"logo": "https://epg.112114.xyz/logo/{name}.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "測試",
|
||||||
|
"type": 1,
|
||||||
|
"url": "https://ghproxy.com/https://raw.githubusercontent.com/FongMi/CatVodSpider/main/json/live.json",
|
||||||
|
"epg": "http://epg.51zmt.top:8000/api/diyp/?ch={name}&date={date}",
|
||||||
|
"logo": "http://epg.51zmt.top:8000/"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"sites": [
|
"sites": [
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"channel": [
|
||||||
|
{
|
||||||
|
"urls": [
|
||||||
|
"http://play-live.ifeng.com/live/06OLEGEGM4G.m3u8"
|
||||||
|
],
|
||||||
|
"number": "001",
|
||||||
|
"logo": "tb1/gt/fenghuangzhongwen.png",
|
||||||
|
"epg": "凤凰中文",
|
||||||
|
"name": "鳳凰中文",
|
||||||
|
"ua": "okhttp/3.15"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"urls": [
|
||||||
|
"http://play-live.ifeng.com/live/06OLEEWQKN4.m3u8"
|
||||||
|
],
|
||||||
|
"number": "002",
|
||||||
|
"logo": "tb1/gt/fenghuangzixun.png",
|
||||||
|
"epg": "凤凰资讯",
|
||||||
|
"name": "鳳凰資訊",
|
||||||
|
"ua": "okhttp/3.15"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "香港"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"channel": [
|
||||||
|
{
|
||||||
|
"urls": [
|
||||||
|
"http://198.16.64.10:8278/xingwei_movie/playlist.m3u8?tid=MBDB4578128345781283&ct=19225&tsum=f2041ec954c95b4a5fe29d7ccbfe5b60"
|
||||||
|
],
|
||||||
|
"number": "003",
|
||||||
|
"logo": "tb1/gt/starmov.png",
|
||||||
|
"epg": "星卫HD电影",
|
||||||
|
"name": "星衛電影"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "台灣"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"channel": [
|
||||||
|
{
|
||||||
|
"urls": [
|
||||||
|
"http://live.redtraffic.xyz/threesome.m3u8"
|
||||||
|
],
|
||||||
|
"number": "1001",
|
||||||
|
"logo": "",
|
||||||
|
"epg": "",
|
||||||
|
"name": "Three"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"urls": [
|
||||||
|
"http://live.redtraffic.xyz/blowjob.m3u8"
|
||||||
|
],
|
||||||
|
"number": "1002",
|
||||||
|
"logo": "",
|
||||||
|
"epg": "",
|
||||||
|
"name": "BlowJob"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "歐美",
|
||||||
|
"pass": "1234"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
@ -15,3 +15,4 @@ dependencyResolutionManagement {
|
||||||
}
|
}
|
||||||
rootProject.name = "CatVodSpider"
|
rootProject.name = "CatVodSpider"
|
||||||
include ':app'
|
include ':app'
|
||||||
|
include ':tools'
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
/build
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
plugins {
|
||||||
|
id 'java-library'
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'com.squareup.okhttp3:okhttp:3.12.13'
|
||||||
|
implementation 'com.google.code.gson:gson:2.8.6'
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
package com.fongmi.tools;
|
||||||
|
|
||||||
|
import com.fongmi.tools.bean.Channel;
|
||||||
|
import com.fongmi.tools.bean.Group;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Run {
|
||||||
|
|
||||||
|
private final List<Group> items = new ArrayList<>();
|
||||||
|
private final Gson gson = new Gson().newBuilder().disableHtmlEscaping().setPrettyPrinting().create();
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
new Run().start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void start() {
|
||||||
|
parse(Util.getFile(getClass(), "live.txt"));
|
||||||
|
System.out.println(gson.toJson(items));
|
||||||
|
writeFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void parse(String text) {
|
||||||
|
for (String line : text.split("\n")) {
|
||||||
|
String[] split = line.split(",");
|
||||||
|
if (split.length < 2) continue;
|
||||||
|
if (line.contains("#genre#")) items.add(Group.create(split[0]));
|
||||||
|
if (!line.contains("://")) continue;
|
||||||
|
Group group = items.get(items.size() - 1);
|
||||||
|
String number = split[0];
|
||||||
|
String epg = split[1];
|
||||||
|
String logo = split[2];
|
||||||
|
String name = split[3];
|
||||||
|
String url = split[4];
|
||||||
|
group.find(Channel.create().number(number).epg(epg).logo(logo).name(name).ua(getUa(url))).addUrls(url.split("#"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getUa(String url) {
|
||||||
|
if (url.contains("play-live.ifeng")) return "okhttp/3.15";
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeFile() {
|
||||||
|
try {
|
||||||
|
File file = new File("json", "live.json");
|
||||||
|
PrintWriter writer = new PrintWriter(file, String.valueOf(StandardCharsets.UTF_8));
|
||||||
|
writer.println(gson.toJson(items));
|
||||||
|
writer.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.fongmi.tools;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
public class Util {
|
||||||
|
|
||||||
|
public static String getFile(Class<?> clz, String fileName) {
|
||||||
|
try {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
URI uri = clz.getClassLoader().getResource(fileName).toURI();
|
||||||
|
Stream<String> stream = Files.lines(Paths.get(uri), StandardCharsets.UTF_8);
|
||||||
|
stream.forEach(s -> sb.append(s).append("\n"));
|
||||||
|
return sb.toString();
|
||||||
|
} catch (Exception e) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
package com.fongmi.tools.bean;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Channel {
|
||||||
|
|
||||||
|
@SerializedName("urls")
|
||||||
|
private List<String> urls;
|
||||||
|
@SerializedName("number")
|
||||||
|
private String number;
|
||||||
|
@SerializedName("logo")
|
||||||
|
private String logo;
|
||||||
|
@SerializedName("epg")
|
||||||
|
private String epg;
|
||||||
|
@SerializedName("name")
|
||||||
|
private String name;
|
||||||
|
@SerializedName("ua")
|
||||||
|
private String ua;
|
||||||
|
|
||||||
|
public static Channel create() {
|
||||||
|
return new Channel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getUrls() {
|
||||||
|
return urls = urls == null ? new ArrayList<>() : urls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNumber() {
|
||||||
|
return number == null ? "" : number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name == null ? "" : name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Channel number(String number) {
|
||||||
|
this.number = number;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Channel logo(String logo) {
|
||||||
|
this.logo = logo;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Channel epg(String epg) {
|
||||||
|
this.epg = epg;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Channel name(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Channel ua(String ua) {
|
||||||
|
this.ua = ua;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addUrls(String... urls) {
|
||||||
|
getUrls().addAll(new ArrayList<>(Arrays.asList(urls)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj) return true;
|
||||||
|
if (!(obj instanceof Channel)) return false;
|
||||||
|
Channel it = (Channel) obj;
|
||||||
|
return getName().equals(it.getName()) || getNumber().equals(it.getNumber());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Sorter implements Comparator<Channel> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(Channel c1, Channel c2) {
|
||||||
|
return Integer.compare(Integer.parseInt(c1.getNumber()), Integer.parseInt(c2.getNumber()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
package com.fongmi.tools.bean;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Group {
|
||||||
|
|
||||||
|
@SerializedName("channel")
|
||||||
|
private List<Channel> channel;
|
||||||
|
@SerializedName("logo")
|
||||||
|
private String logo;
|
||||||
|
@SerializedName("name")
|
||||||
|
private String name;
|
||||||
|
@SerializedName("pass")
|
||||||
|
private String pass;
|
||||||
|
|
||||||
|
public static Group create(String name) {
|
||||||
|
return new Group(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Group(String name) {
|
||||||
|
this.name = name;
|
||||||
|
if (!name.contains("_")) return;
|
||||||
|
setName(name.split("_")[0]);
|
||||||
|
setPass(name.split("_")[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Channel> getChannel() {
|
||||||
|
return channel = channel == null ? new ArrayList<>() : channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLogo(String logo) {
|
||||||
|
this.logo = logo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name == null ? "" : name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPass(String pass) {
|
||||||
|
this.pass = pass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Channel find(Channel channel) {
|
||||||
|
int index = getChannel().indexOf(channel);
|
||||||
|
if (index != -1) return getChannel().get(index);
|
||||||
|
getChannel().add(channel);
|
||||||
|
return channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (obj == null) return false;
|
||||||
|
if (this == obj) return true;
|
||||||
|
if (!(obj instanceof Group)) return false;
|
||||||
|
Group it = (Group) obj;
|
||||||
|
return getName().equals(it.getName()) && getChannel().size() == it.getChannel().size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
香港,#genre#
|
||||||
|
001,凤凰中文,tb1/gt/fenghuangzhongwen.png,鳳凰中文,http://play-live.ifeng.com/live/06OLEGEGM4G.m3u8
|
||||||
|
002,凤凰资讯,tb1/gt/fenghuangzixun.png,鳳凰資訊,http://play-live.ifeng.com/live/06OLEEWQKN4.m3u8
|
||||||
|
台灣,#genre#
|
||||||
|
003,星卫HD电影,tb1/gt/starmov.png,星衛電影,http://198.16.64.10:8278/xingwei_movie/playlist.m3u8?tid=MBDB4578128345781283&ct=19225&tsum=f2041ec954c95b4a5fe29d7ccbfe5b60
|
||||||
|
歐美_1234,#genre#
|
||||||
|
1001,,,Three,http://live.redtraffic.xyz/threesome.m3u8
|
||||||
|
1002,,,BlowJob,http://live.redtraffic.xyz/blowjob.m3u8
|
||||||
Loading…
Reference in New Issue