├── .gitattributes
├── .gitignore
├── LiveParser
├── .classpath
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
├── bin
│ └── com
│ │ └── zhang
│ │ └── extractor
│ │ ├── AhtvHandler.class
│ │ ├── CntvHandler.class
│ │ ├── Common.class
│ │ ├── IFengHandler.class
│ │ ├── LetvAlg.class
│ │ ├── LetvHandler.class
│ │ ├── LiveHandler.class
│ │ ├── PPTVHandler.class
│ │ ├── QQHandler.class
│ │ ├── SohuHandler.class
│ │ ├── StaticHandler.class
│ │ ├── Test.class
│ │ └── WasuHandler.class
└── src
│ └── com
│ └── zhang
│ └── extractor
│ ├── AhtvHandler.java
│ ├── CntvHandler.java
│ ├── Common.java
│ ├── IFengHandler.java
│ ├── LetvAlg.java
│ ├── LetvHandler.java
│ ├── LiveHandler.java
│ ├── PPTVHandler.java
│ ├── QQHandler.java
│ ├── SohuHandler.java
│ ├── StaticHandler.java
│ ├── Test.java
│ └── WasuHandler.java
└── README.md
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows image file caches
2 | Thumbs.db
3 | ehthumbs.db
4 |
5 | # Folder config file
6 | Desktop.ini
7 |
8 | # Recycle Bin used on file shares
9 | $RECYCLE.BIN/
10 |
11 | # Windows Installer files
12 | *.cab
13 | *.msi
14 | *.msm
15 | *.msp
16 |
17 | # Windows shortcuts
18 | *.lnk
19 |
20 | # =========================
21 | # Operating System Files
22 | # =========================
23 |
24 | # OSX
25 | # =========================
26 |
27 | .DS_Store
28 | .AppleDouble
29 | .LSOverride
30 |
31 | # Thumbnails
32 | ._*
33 |
34 | # Files that might appear on external disk
35 | .Spotlight-V100
36 | .Trashes
37 |
38 | # Directories potentially created on remote AFP share
39 | .AppleDB
40 | .AppleDesktop
41 | Network Trash Folder
42 | Temporary Items
43 | .apdisk
44 |
--------------------------------------------------------------------------------
/LiveParser/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/LiveParser/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | LiveParser
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/LiveParser/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=1.7
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 | org.eclipse.jdt.core.compiler.source=1.7
12 |
--------------------------------------------------------------------------------
/LiveParser/bin/com/zhang/extractor/AhtvHandler.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blackbluezx/LiveParser/d0c092b814c7724a9f48f0b12a249f1eb50f2b8d/LiveParser/bin/com/zhang/extractor/AhtvHandler.class
--------------------------------------------------------------------------------
/LiveParser/bin/com/zhang/extractor/CntvHandler.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blackbluezx/LiveParser/d0c092b814c7724a9f48f0b12a249f1eb50f2b8d/LiveParser/bin/com/zhang/extractor/CntvHandler.class
--------------------------------------------------------------------------------
/LiveParser/bin/com/zhang/extractor/Common.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blackbluezx/LiveParser/d0c092b814c7724a9f48f0b12a249f1eb50f2b8d/LiveParser/bin/com/zhang/extractor/Common.class
--------------------------------------------------------------------------------
/LiveParser/bin/com/zhang/extractor/IFengHandler.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blackbluezx/LiveParser/d0c092b814c7724a9f48f0b12a249f1eb50f2b8d/LiveParser/bin/com/zhang/extractor/IFengHandler.class
--------------------------------------------------------------------------------
/LiveParser/bin/com/zhang/extractor/LetvAlg.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blackbluezx/LiveParser/d0c092b814c7724a9f48f0b12a249f1eb50f2b8d/LiveParser/bin/com/zhang/extractor/LetvAlg.class
--------------------------------------------------------------------------------
/LiveParser/bin/com/zhang/extractor/LetvHandler.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blackbluezx/LiveParser/d0c092b814c7724a9f48f0b12a249f1eb50f2b8d/LiveParser/bin/com/zhang/extractor/LetvHandler.class
--------------------------------------------------------------------------------
/LiveParser/bin/com/zhang/extractor/LiveHandler.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blackbluezx/LiveParser/d0c092b814c7724a9f48f0b12a249f1eb50f2b8d/LiveParser/bin/com/zhang/extractor/LiveHandler.class
--------------------------------------------------------------------------------
/LiveParser/bin/com/zhang/extractor/PPTVHandler.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blackbluezx/LiveParser/d0c092b814c7724a9f48f0b12a249f1eb50f2b8d/LiveParser/bin/com/zhang/extractor/PPTVHandler.class
--------------------------------------------------------------------------------
/LiveParser/bin/com/zhang/extractor/QQHandler.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blackbluezx/LiveParser/d0c092b814c7724a9f48f0b12a249f1eb50f2b8d/LiveParser/bin/com/zhang/extractor/QQHandler.class
--------------------------------------------------------------------------------
/LiveParser/bin/com/zhang/extractor/SohuHandler.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blackbluezx/LiveParser/d0c092b814c7724a9f48f0b12a249f1eb50f2b8d/LiveParser/bin/com/zhang/extractor/SohuHandler.class
--------------------------------------------------------------------------------
/LiveParser/bin/com/zhang/extractor/StaticHandler.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blackbluezx/LiveParser/d0c092b814c7724a9f48f0b12a249f1eb50f2b8d/LiveParser/bin/com/zhang/extractor/StaticHandler.class
--------------------------------------------------------------------------------
/LiveParser/bin/com/zhang/extractor/Test.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blackbluezx/LiveParser/d0c092b814c7724a9f48f0b12a249f1eb50f2b8d/LiveParser/bin/com/zhang/extractor/Test.class
--------------------------------------------------------------------------------
/LiveParser/bin/com/zhang/extractor/WasuHandler.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blackbluezx/LiveParser/d0c092b814c7724a9f48f0b12a249f1eb50f2b8d/LiveParser/bin/com/zhang/extractor/WasuHandler.class
--------------------------------------------------------------------------------
/LiveParser/src/com/zhang/extractor/AhtvHandler.java:
--------------------------------------------------------------------------------
1 | package com.zhang.extractor;
2 |
3 | public class AhtvHandler {
4 |
5 | private static final String prefix = "http://www.ahtv.cn/m2o/player/drm.php?url=";
6 |
7 | public static String getLiveUrl(String key){
8 | String html = Common.getHtml(prefix+key);
9 | String liveurl = null;
10 | if(html!=null)
11 | liveurl = html;
12 | return liveurl;
13 | }
14 |
15 | public static void main(String[] args) {
16 | System.out.print(getLiveUrl("http://stream2.ahtv.cn/ahws/cd/live.m3u8"));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/LiveParser/src/com/zhang/extractor/CntvHandler.java:
--------------------------------------------------------------------------------
1 | package com.zhang.extractor;
2 |
3 | public class CntvHandler {
4 |
5 | private static final String s1="http://vdn.live.cntv.cn/api2/liveHtml5.do?channel=pa://cctv_p2p_hd";
6 | private static final String s2="&client=html5";
7 |
8 | public static String getLiveUrl(String key){
9 | String key1 = key.split(":")[0];
10 | String key2 = key.split(":")[1];
11 | String url = s1+key1+s2;
12 | String html = Common.htmlget(url);
13 | String liveurl1 = null;
14 | if(html!=null){
15 | liveurl1 = Common.r1(html, key2+"\":\"(.*?)\"");
16 | }
17 | return liveurl1;
18 | }
19 |
20 | public static void main(String[] args) {
21 | System.out.print(getLiveUrl("cctv1:hls4"));
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/LiveParser/src/com/zhang/extractor/Common.java:
--------------------------------------------------------------------------------
1 | package com.zhang.extractor;
2 |
3 | import java.io.BufferedReader;
4 | import java.io.InputStream;
5 | import java.io.InputStreamReader;
6 | import java.net.HttpURLConnection;
7 | import java.net.URL;
8 | import java.util.regex.Matcher;
9 | import java.util.regex.Pattern;
10 |
11 | public class Common {
12 |
13 | public static String getRedirectUrl(String url){
14 | String decodedUrl = url;
15 | URL redirectUrl;
16 | try {
17 | redirectUrl = new URL(decodedUrl);
18 | HttpURLConnection conn = (HttpURLConnection) redirectUrl.openConnection();
19 | conn.setConnectTimeout(30000);
20 | conn.getResponseCode();
21 | decodedUrl = conn.getURL().toString();
22 | conn.disconnect();
23 | } catch (Exception e) {
24 | // TODO Auto-generated catch block
25 | e.printStackTrace();
26 | }
27 | return decodedUrl;
28 | }
29 |
30 | public static String r1(String html,String pattern){
31 | String con = null;
32 | if(html==null)
33 | return con;
34 | Pattern p = Pattern.compile(pattern);
35 | Matcher m = p.matcher(html);
36 | while(m.find()){
37 | con = m.group(1);
38 | }
39 | return con;
40 | }
41 |
42 | public static String getHtml(String url){
43 | String html = null;
44 | for(int i=0;i<3;i++){
45 | html = getHtmlContent(url, "utf-8");
46 | if(html!=null)
47 | break;
48 | }
49 | return html;
50 | }
51 |
52 | public static String htmlget(String url){
53 | String html = null;
54 | for(int i=0;i<3;i++){
55 | html = getPageSource(url, "utf-8");
56 | if(html!=null)
57 | break;
58 | }
59 | return html;
60 | }
61 |
62 | public static String getPageSource(String pageUrl,String encoding) {
63 | StringBuffer sb = new StringBuffer();
64 | try {
65 | URL url = new URL(pageUrl);
66 | BufferedReader in = new BufferedReader(new InputStreamReader(url
67 | .openStream(), encoding));
68 | String line;
69 | while ((line = in.readLine()) != null) {
70 | sb.append(line);
71 | sb.append("\n");
72 | }
73 | in.close();
74 | } catch (Exception ex) {
75 | System.err.println(ex);
76 | }
77 | return sb.toString();
78 | }
79 |
80 | public static String getHtmlContent(String surl, String encode) {
81 | String content = null;
82 | StringBuffer contentBuffer = new StringBuffer();
83 | URL url = null;
84 | HttpURLConnection con = null;
85 | try {
86 | url = new URL(surl);
87 | con = (HttpURLConnection) url.openConnection();
88 | con.setRequestMethod("GET");
89 | con.setRequestProperty("User-Agent",
90 | "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11B554a Safari/9537.53"
91 | // "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)"
92 | );// IOS代理
93 | con.setConnectTimeout(30000);
94 | con.setReadTimeout(30000);
95 |
96 | // 获得网页返回信息码
97 | int responseCode = con.getResponseCode();
98 | if (responseCode == -1) {
99 | System.out.println(url.toString() + " : connection is failure...");
100 | con.disconnect();
101 | return null;
102 | }
103 | if (responseCode >= 400) // 请求失败
104 | {
105 | System.out.println("请求失败:get response code: " + responseCode);
106 | con.disconnect();
107 | return null;
108 | }
109 |
110 | InputStream inStr = con.getInputStream();
111 | InputStreamReader istreamReader = new InputStreamReader(inStr, encode);
112 | BufferedReader buffStr = new BufferedReader(istreamReader);
113 |
114 | String str = null;
115 | while ((str = buffStr.readLine()) != null)
116 | contentBuffer.append(str+"\n");
117 | inStr.close();
118 |
119 | content = contentBuffer.toString();
120 | } catch (Exception e) {
121 | e.printStackTrace();
122 | contentBuffer = null;
123 | content = null;
124 | } finally {
125 | con.disconnect();
126 | }
127 | return content;
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
/LiveParser/src/com/zhang/extractor/IFengHandler.java:
--------------------------------------------------------------------------------
1 | package com.zhang.extractor;
2 |
3 | public class IFengHandler {
4 |
5 | public static String getLiveUrl(String key){
6 | String liveurl = null;
7 | if(key!=null)
8 | liveurl = key;
9 | return liveurl;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/LiveParser/src/com/zhang/extractor/LetvAlg.java:
--------------------------------------------------------------------------------
1 | package com.zhang.extractor;
2 |
3 | import java.security.MessageDigest;
4 |
5 | public class LetvAlg {
6 |
7 | private static final String suffixurl = "&sign=live_phone&format=1&platid=10&playid=1&splatid=1006";
8 | private static final String servtimeurl = "http://api.letv.com/time";
9 | private static final String mainurl = "http://gslb.live.video123456.com/gslb?tag=live&ext=m3u8&stream_id=";
10 | // private static final String mainurl = "http://live.gslb.letv.com/gslb?tag=live&ext=m3u8&stream_id=";
11 | private static final String param = "expect=3&termid=2&pay=0&ostype=macos&hwtype=iphone";
12 |
13 | public String createSource(String stream_id){
14 | String url = onGetTimeSucc(stream_id);
15 | String html = Common.getHtml(url);
16 | String hlsUrl = Common.r1(html, "\"location\": \"(.*?)\", \"nodelist");
17 | if(hlsUrl!=null)
18 | hlsUrl = hlsUrl.replace("\\", "");
19 | return hlsUrl;
20 | }
21 |
22 | public String onGetTimeSucc(String streamId){
23 | int stime = getServerTime()+600 ;
24 | String tkey = getKey(streamId, stime);
25 | String url = mainurl+streamId+"&"+param+suffixurl+"&tm="+stime+"&key="+tkey+"&callback=?";
26 | return url;
27 | }
28 |
29 | public int getServerTime(){
30 | int time = 0;
31 | String timeJsonp = Common.getHtml(servtimeurl).replace("}", "end");
32 | String stime = Common.r1(timeJsonp, "stime\":(.*?)end");
33 | if(stime!=null){
34 | time = Integer.parseInt(stime);
35 | }else{
36 | time = (int) (System.currentTimeMillis()/1000);
37 | }
38 | return time;
39 | }
40 |
41 | public String getKey(String streamid,int time){
42 | String stime = time+"";
43 | String hashkey = streamid+","+stime+",feda8dd6e0127da88f3487a646fe8a6b";
44 | String key = MD5(hashkey);
45 | return key;
46 | }
47 |
48 | public final static String MD5(String s) {
49 | char hexDigits[]={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
50 | try {
51 | byte[] btInput = s.getBytes();
52 | MessageDigest mdInst = MessageDigest.getInstance("MD5");
53 | mdInst.update(btInput);
54 | byte[] md = mdInst.digest();
55 | int j = md.length;
56 | char str[] = new char[j * 2];
57 | int k = 0;
58 | for (int i = 0; i < j; i++) {
59 | byte byte0 = md[i];
60 | str[k++] = hexDigits[byte0 >>> 4 & 0xf];
61 | str[k++] = hexDigits[byte0 & 0xf];
62 | }
63 | return new String(str);
64 | } catch (Exception e) {
65 | e.printStackTrace();
66 | return "";
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/LiveParser/src/com/zhang/extractor/LetvHandler.java:
--------------------------------------------------------------------------------
1 | package com.zhang.extractor;
2 |
3 | public class LetvHandler {
4 |
5 | // private static final String letvUrlPreffix = "http://202.38.73.228:9877/a/letv?key=";
6 |
7 | public static String getLiveUrl(String key){
8 | String letvUrl = null;
9 | String liveKey = key.split(",")[0].split("\\|")[1];
10 | try{
11 | // letvUrl = Common.getHtml(letvUrlPreffix+liveKey);
12 | // if((letvUrl == null) || (letvUrl.equals(""))){
13 | LetvAlg letvAlg = new LetvAlg();
14 | String url = letvAlg.createSource(liveKey);
15 | letvUrl = url;
16 | // }
17 | // letvUrl = URLDecoder.decode(letvUrl,"utf-8");
18 | }catch(Exception e){
19 | e.printStackTrace();
20 | }
21 | return letvUrl;
22 | }
23 |
24 | public static void main(String[] args){
25 | System.out.println(getLiveUrl("0|jiangsuHD_1800|800,0|jiangsuHD_800|800"));
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/LiveParser/src/com/zhang/extractor/LiveHandler.java:
--------------------------------------------------------------------------------
1 | package com.zhang.extractor;
2 |
3 | import java.net.URLDecoder;
4 |
5 | public class LiveHandler {
6 |
7 | public String getLiveUrl(String key,String web){
8 | String liveUrl = null;
9 | String liveKey = null;
10 | try{
11 | liveKey = URLDecoder.decode(key, "utf-8");
12 | switch(web){
13 | case("cntv"):
14 | liveUrl = CntvHandler.getLiveUrl(liveKey);
15 | break;
16 | case("ahtv"):
17 | liveUrl = AhtvHandler.getLiveUrl(liveKey);
18 | break;
19 | case("ifeng"):
20 | liveUrl = IFengHandler.getLiveUrl(liveKey);
21 | break;
22 | case("letv"):
23 | liveUrl = LetvHandler.getLiveUrl(liveKey);
24 | break;
25 | case("pptv"):
26 | liveUrl = PPTVHandler.getLiveUrl(liveKey);
27 | break;
28 | case("qq"):
29 | liveUrl = QQHandler.getLiveUrl(liveKey);
30 | break;
31 | case("sohu"):
32 | liveUrl = SohuHandler.getLiveUrl(liveKey);
33 | break;
34 | case("wasu"):
35 | liveUrl = WasuHandler.getLiveUrl(liveKey);
36 | break;
37 | default:
38 | liveUrl = StaticHandler.getLiveUrl(liveKey);
39 | break;
40 | }
41 | if((liveUrl==null)||(liveUrl.equals("")))
42 | liveUrl = "http://202.38.73.228/error";
43 | }catch(Exception e){
44 | e.printStackTrace();
45 | liveUrl = "http://202.38.73.228/error";
46 | }
47 | return liveUrl;
48 | }
49 |
50 | public static void main(String[] args) {
51 | LiveHandler l = new LiveHandler();
52 | String url = l.getLiveUrl("0|jiangsuHD_1800|800,0|jiangsuHD_800|800", "letv");
53 | System.out.println(url);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/LiveParser/src/com/zhang/extractor/PPTVHandler.java:
--------------------------------------------------------------------------------
1 | package com.zhang.extractor;
2 |
3 | public class PPTVHandler {
4 |
5 | public static String getLiveUrl(String key){
6 | String liveurl = null;
7 | String url1 = key.split("&")[0];
8 | String vid = Common.r1(url1, ".*m3u8-(.*?).m3u8.");
9 | if(vid!=null)
10 | liveurl = "http://play.api.pptv.com/web-m3u8-"+vid+".m3u8?type=ipad";
11 | return liveurl;
12 | }
13 |
14 | public static void main(String[] args) {
15 | System.out.println(getLiveUrl("http://web-play.pptv.com/web-m3u8-300188.m3u8?type=m3u8.web.phone&playback=0$http://v.pptv.com/show/nEalI4vxYZ8CgOg.html"));
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/LiveParser/src/com/zhang/extractor/QQHandler.java:
--------------------------------------------------------------------------------
1 | package com.zhang.extractor;
2 |
3 | public class QQHandler {
4 |
5 | public static String getLiveUrl(String key){
6 | String liveurl = null;
7 | liveurl = "http://zb.v.qq.com:1863/?progid="+key;
8 | return liveurl;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/LiveParser/src/com/zhang/extractor/SohuHandler.java:
--------------------------------------------------------------------------------
1 | package com.zhang.extractor;
2 |
3 | public class SohuHandler {
4 |
5 | private static final String prefix = "http://live.tv.sohu.com/live/player_json.jhtml?type=1&ipad=1&lid=";
6 |
7 | public static String getLiveUrl(String key){
8 | String liveurl = null;
9 | String html = Common.getHtml(prefix+key);
10 | if(html!=null){
11 | String cid = Common.r1(html, "cid\":(.*?),");
12 | if(cid!=null){
13 | liveurl = "http://gslb.tv.sohu.com/live?cid="+cid+"&type=hls&ctype=m3u8";
14 | }else{
15 | String hlsUrl = Common.r1(html, "live\":\"(.*?)\",");
16 | System.out.print(hlsUrl);
17 | liveurl = Common.getRedirectUrl(hlsUrl);
18 | }
19 | }
20 | return liveurl;
21 | }
22 |
23 | public static void main(String[] args) {
24 | System.out.print(getLiveUrl("74"));
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/LiveParser/src/com/zhang/extractor/StaticHandler.java:
--------------------------------------------------------------------------------
1 | package com.zhang.extractor;
2 |
3 | public class StaticHandler {
4 |
5 | public static String getLiveUrl(String key){
6 | String liveurl = null;
7 | if(key!=null)
8 | liveurl = key;
9 | return liveurl;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/LiveParser/src/com/zhang/extractor/Test.java:
--------------------------------------------------------------------------------
1 | package com.zhang.extractor;
2 |
3 | public class Test {
4 |
5 | public static String getLiveUrl(String str,String uid){
6 | String result = null;
7 | if(str!=null){
8 | result = Common.r1(str, "(\\d)\\+"+uid);
9 | }
10 | return result;
11 | }
12 |
13 | public static void main(String[] args) {
14 | System.out.print(getLiveUrl("1+t123","t666"));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/LiveParser/src/com/zhang/extractor/WasuHandler.java:
--------------------------------------------------------------------------------
1 | package com.zhang.extractor;
2 |
3 | public class WasuHandler {
4 |
5 | private static final String url2 = "http://m.wasu.cn/?profile=wasunitedh5_cj";
6 | private static final String wasuOwn = "http://202.38.73.228:9877/a/wasu?url=";
7 |
8 | public static String getWasuUrlByOwn(String url){
9 | String wasuUrl = null;
10 | try {
11 | wasuUrl = Common.getHtml(wasuOwn+url);
12 | } catch (Exception e) {
13 | // TODO Auto-generated catch block
14 | e.printStackTrace();
15 | }
16 | return wasuUrl;
17 | }
18 |
19 | public static String getWasuKey(){
20 | String vkey = null;
21 | try{
22 | String url = Common.getRedirectUrl("http://m.wasu.cn");
23 | String html = null;
24 | if(url.equals("http://m.wasu.cn")){
25 | html = Common.getHtml(url2);
26 | }else{
27 | html = Common.getHtml(url.replace(":80", "/"));
28 | }
29 | if(html!=null){
30 | String vstr = Common.r1(html, "直播");
31 | if(vstr!=null){
32 | vkey = vstr.split("&")[0].replace("/a?u=","");
33 | }
34 | }
35 | }catch(Exception e){
36 | e.printStackTrace();
37 | }
38 | return vkey;
39 | }
40 |
41 | public static String getLiveUrl(String key){
42 | String liveurl = null;
43 | try{
44 | String vkey = getWasuKey();
45 | System.out.println(vkey);
46 | if(vkey==null){
47 | liveurl = getWasuUrlByOwn(key);
48 | return liveurl;
49 | }
50 | if(vkey!=null){
51 | String url2 = key.replace("RDUCHS-NB3G-IPS-03141024706625821", vkey);
52 | String html2 = Common.getHtml(url2);
53 | liveurl = Common.r1(html2, "url' : '(.*?)'");
54 | }
55 | }catch(Exception e){
56 | e.printStackTrace();
57 | }
58 | return liveurl;
59 | }
60 |
61 | public static void main(String[] args) {
62 | System.out.println(getLiveUrl("http://m.wasu.cn/content,freewap,RDUCHS-NB3G-IPS-03141024706625821,148512,38,6406182.page"));
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # LiveParser
2 | 国内主要的一些直播电视网站直播解析算法
3 | java编写的一些直播解析算法
4 |
--------------------------------------------------------------------------------