1 | #ifndef STREAMLIVE_H |
---|
2 | #define STREAMLIVE_H |
---|
3 | |
---|
4 | char* streamlive(char* link, int incount) |
---|
5 | { |
---|
6 | debug(99, "streamlive(%d) link=%s", incount, link); |
---|
7 | |
---|
8 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
9 | char* streamurl = NULL, *tmpstr = NULL, *tmpstr1 = NULL; |
---|
10 | char* streamer = NULL; |
---|
11 | char* playpath = NULL; |
---|
12 | char* swfurl = NULL; |
---|
13 | char* app = NULL; |
---|
14 | char* token = NULL; |
---|
15 | char* url1 = NULL; |
---|
16 | char* url2 = NULL; |
---|
17 | char* url3 = NULL; |
---|
18 | char* host = NULL; |
---|
19 | char* path = NULL; |
---|
20 | char* id = NULL; |
---|
21 | |
---|
22 | char* streamurl1 = NULL; |
---|
23 | // char* title = NULL; |
---|
24 | // char* pic = NULL; |
---|
25 | char* typemsg = NULL; |
---|
26 | |
---|
27 | typemsg = string_resub("http://", "/", link, 0); |
---|
28 | |
---|
29 | /* |
---|
30 | http://www.streamlive.to/embedplayer_new.php?width=640&height=480&channel=71562&autoplay=true |
---|
31 | http://www.streamlive.to/view/72736/BT_Sport_2-live-stream-channel |
---|
32 | */ |
---|
33 | if(ostrstr(link, "http://www.streamlive.to/view/") != NULL) |
---|
34 | { |
---|
35 | id = string_resub("/view/", "/", link, 0); |
---|
36 | url1 = ostrcat("http://www.streamlive.to/embedplayer_new.php?width=640&height=480&channel=", id, 0, 0); |
---|
37 | url1 = ostrcat(url1, "&autoplay=true", 1, 0); |
---|
38 | } |
---|
39 | else |
---|
40 | url1 = ostrcat(link, NULL, 0, 0); |
---|
41 | |
---|
42 | //<script type="text/javascript" src="http://www.streamlive.to/embed/69654&width=650&height=480&autoplay=true"></script> |
---|
43 | tmpstr = gethttps(url1, NULL, NULL, NULL, NULL, NULL, 1); |
---|
44 | host = string_resub("http://", "/", url1, 0); |
---|
45 | path = string_replace_all(host, "", url1, 0); |
---|
46 | path = string_replace_all("http://", "", path, 1); |
---|
47 | path = string_replace_all(" ", "%20", path, 1); |
---|
48 | titheklog(debuglevel, "/var/usr/local/share/titan/plugins/tithek/tvtoast4_tmpstr", oitoa(incount), host, path, tmpstr); |
---|
49 | |
---|
50 | if(ostrstr(tmpstr, "'file': 'http") != NULL) |
---|
51 | { |
---|
52 | streamurl1 = string_resub("'file': 'http", "'", tmpstr, 0); |
---|
53 | streamurl1 = ostrcat("http", streamurl1, 0, 1); |
---|
54 | } |
---|
55 | |
---|
56 | if(ostrstr(tmpstr, "rtmp") == NULL) |
---|
57 | { |
---|
58 | // document.write("<iframe src='http://www.streamlive.to/embedplayer_new.php?width=650&height=480&channel=69654&autoplay=true' frameborder='0' marginheight='0' marginwidth='0' scrolling='no' width='650' height='480'></iframe>"); |
---|
59 | url2 = string_resub("src='", "'", tmpstr, 0); |
---|
60 | free(tmpstr), tmpstr = NULL; |
---|
61 | tmpstr = gethttps(url2, NULL, NULL, NULL, NULL, url1, 1); |
---|
62 | free(host), host = NULL; |
---|
63 | free(path), path = NULL; |
---|
64 | host = string_resub("http://", "/", url2, 0); |
---|
65 | path = string_replace_all(host, "", url2, 0); |
---|
66 | path = string_replace_all("http://", "", path, 1); |
---|
67 | path = string_replace_all(" ", "%20", path, 1); |
---|
68 | titheklog(debuglevel, "/var/usr/local/share/titan/plugins/tithek/tvtoast5_tmpstr", oitoa(incount), host, path, tmpstr); |
---|
69 | } |
---|
70 | |
---|
71 | if(ostrstr(tmpstr, "'file': 'http") != NULL) |
---|
72 | { |
---|
73 | streamurl1 = string_resub("'file': 'http", "'", tmpstr, 0); |
---|
74 | streamurl1 = ostrcat("http", streamurl1, 0, 1); |
---|
75 | } |
---|
76 | |
---|
77 | //streamer: "rtmp:\/\/163.172.8.19:1935\/edge\/_definst_\/?xs=_we_eXVtN2d4emZubWNnYXd0fDE0NDc2ODg2ODR8OTUuOTEuNi4yNXw1NjQ4YTg2Yzg5ZWEwfDVhOTkxZWIzY2JiNzA0NjYyM2Y4ODVlODY0NDhhZTJmNDM0OTc4ODI.", |
---|
78 | streamer = string_resub("streamer: \"", "\"", tmpstr, 0); |
---|
79 | streamer = string_replace_all("\\", "", streamer, 1); |
---|
80 | debug(99, "tvtoast5_tmpstr%d streamer=%s", incount, streamer) |
---|
81 | if(streamer != NULL) |
---|
82 | { |
---|
83 | playpath = string_resub("file: \"", "\"", tmpstr, 0); |
---|
84 | playpath = string_replace_all(".flv", "", playpath, 1); |
---|
85 | debug(99, "tvtoast5_tmpstr%d playpath=%s", incount, playpath) |
---|
86 | |
---|
87 | swfurl = string_resub("type: 'flash', src: '", "'", tmpstr, 0); |
---|
88 | swfurl = string_replace_all("//", "http://", swfurl, 1); |
---|
89 | debug(99, "tvtoast5_tmpstr%d swfurl=%s", incount, swfurl) |
---|
90 | |
---|
91 | app = ostrcat(streamer, NULL, 0, 0); |
---|
92 | tmpstr1 = string_resub("rtmp://", "/", app, 0); |
---|
93 | app = string_replace(tmpstr1, "", app, 0); |
---|
94 | free(tmpstr1), tmpstr1 = NULL; |
---|
95 | app = string_replace_all("rtmp:///", "", app, 1); |
---|
96 | debug(99, "tvtoast5_tmpstr%d app5=%s", incount, app) |
---|
97 | |
---|
98 | //$.getJSON("//www.streamlive.to/server.php?id=1447602284", function(json){ |
---|
99 | url3 = string_resub("getJSON(\"", "\"", tmpstr, 0); |
---|
100 | url3 = string_replace_all("//", "http://", url3, 1); |
---|
101 | free(tmpstr), tmpstr = NULL; |
---|
102 | |
---|
103 | tmpstr = gethttps(url3, NULL, NULL, NULL, NULL, url2, 1); |
---|
104 | free(host), host = NULL; |
---|
105 | free(path), path = NULL; |
---|
106 | host = string_resub("http://", "/", url3, 0); |
---|
107 | path = string_replace_all(host, "", url3, 0); |
---|
108 | path = string_replace_all("http://", "", path, 1); |
---|
109 | path = string_replace_all(" ", "%20", path, 1); |
---|
110 | titheklog(debuglevel, "/var/usr/local/share/titan/plugins/tithek/tvtoast6_tmpstr", oitoa(incount), host, path, tmpstr); |
---|
111 | |
---|
112 | token = string_resub("{\"token\":\"", "\"", tmpstr, 0); |
---|
113 | free(tmpstr), tmpstr = NULL; |
---|
114 | |
---|
115 | /* |
---|
116 | rtmp://163.172.8.19:1935/edge/_definst_/?xs=_we_Mzcxamx1aXJsamNzamVufDE0NDc2ODk3ODJ8OTUuOTEuNi4yNXw1NjQ4YWNiNjQ4MDNhfGE5ZjdhNzgyZmUwZmVhZWFhYjBhYTEyMjc4MTE5NGY3NWMxMjE4YmU. app=edge/_definst_/?xs=_we_Mzcxamx1aXJsamNzamVufDE0NDc2ODk3ODJ8OTUuOTEuNi4yNXw1NjQ4YWNiNjQ4MDNhfGE5ZjdhNzgyZmUwZmVhZWFhYjBhYTEyMjc4MTE5NGY3NWMxMjE4YmU. playpath=371jluirljcsjen swfUrl=http://www.streamlive.to/ads/embed/player_ilive_embed.swf live=1 timeout=15 token=D57b0914d73be4057f69d6443745ed28 pageUrl=http://www.streamlive.to/embedplayer_new.php?width=640&height=480&channel=68969&autoplay=true |
---|
117 | */ |
---|
118 | if(streamer != NULL) |
---|
119 | { |
---|
120 | // without app not working |
---|
121 | streamurl = ostrcat(streamer, " app=", 0, 0); |
---|
122 | streamurl = ostrcat(streamurl, app, 1, 0); |
---|
123 | streamurl = ostrcat(streamurl, " playpath=", 1, 0); |
---|
124 | streamurl = ostrcat(streamurl, playpath, 1, 0); |
---|
125 | streamurl = ostrcat(streamurl, " swfUrl=", 1, 0); |
---|
126 | streamurl = ostrcat(streamurl, swfurl, 1, 0); |
---|
127 | streamurl = ostrcat(streamurl, " live=1", 1, 0); |
---|
128 | streamurl = ostrcat(streamurl, " timeout=15", 1, 0); |
---|
129 | streamurl = ostrcat(streamurl, " token=", 1, 0); |
---|
130 | streamurl = ostrcat(streamurl, token, 1, 0); |
---|
131 | streamurl = ostrcat(streamurl, " pageUrl=", 1, 0); |
---|
132 | streamurl = ostrcat(streamurl, url1, 1, 0); |
---|
133 | } |
---|
134 | } |
---|
135 | |
---|
136 | free(streamer), streamer = NULL; |
---|
137 | free(app), app = NULL; |
---|
138 | free(playpath), playpath = NULL; |
---|
139 | free(swfurl), swfurl = NULL; |
---|
140 | free(token), token = NULL; |
---|
141 | free(url1), url1 = NULL; |
---|
142 | free(url2), url2 = NULL; |
---|
143 | free(url3), url3 = NULL; |
---|
144 | |
---|
145 | free(host), host = NULL; |
---|
146 | free(path), path = NULL; |
---|
147 | free(id), id = NULL; |
---|
148 | |
---|
149 | debug(99, "streamurl %s", streamurl); |
---|
150 | return streamurl; |
---|
151 | } |
---|
152 | |
---|
153 | #endif |
---|