source: titan/plugins/tithek/streamlive.h @ 40135

Last change on this file since 40135 was 38013, checked in by obi, 8 years ago

fix crcfree

File size: 7.4 KB
Line 
1#ifndef STREAMLIVE_H
2#define STREAMLIVE_H
3
4char* 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/*
30http://www.streamlive.to/embedplayer_new.php?width=640&height=480&channel=71562&autoplay=true
31http://www.streamlive.to/view/72736/BT_Sport_2-live-stream-channel
32*/
33printf("111111111\n");
34
35        if(ostrstr(link, "http://www.streamlive.to/view/") != NULL)
36        {
37printf("222222222\n");
38
39                id = string_resub("/view/", "/", link, 0);
40                url1 = ostrcat("http://www.streamlive.to/embedplayer_new.php?width=640&height=480&channel=", id, 0, 0);
41                url1 = ostrcat(url1, "&autoplay=true", 1, 0);
42        }
43        else
44        {
45printf("333333333\n");
46
47                url1 = ostrcat(link, NULL, 0, 0);
48        }
49printf("444444444\n");
50
51        printf("############################################################\n");
52        printf("url1234: %s\n", url1);
53        printf("############################################################\n");
54
55
56
57//<script type="text/javascript" src="http://www.streamlive.to/embed/69654&width=650&height=480&autoplay=true"></script>
58        tmpstr = gethttps(url1, NULL, NULL, NULL, NULL, NULL, 1);
59        host = string_resub("http://", "/", url1, 0);
60        path = string_replace_all(host, "", url1, 0);
61
62//      tmpstr = gethttps(link, NULL, NULL, NULL, NULL, NULL, 1);
63//      host = string_resub("http://", "/", link, 0);
64//      path = string_replace_all(host, "", link, 0);
65
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/tvtoast4_tmpstr", oitoa(incount), host, path, tmpstr);
69
70        if(ostrstr(tmpstr, "<h1>To prove that you are not bot, please answer the question to continue</h1>") != NULL)
71        {
72//              Question: Type this word in the box: walking dead<br /><br />
73//              Question: Type the following word in the box: lovelivetv<br /><br />
74//              Question: Type this Honda car SUV in the box: crvhonda<br
75                printf("tmpstr: %s\n", tmpstr);
76
77                char* data = oregex(".*Question:.*: (.*)<br /><br />.*", tmpstr);
78
79                data = ostrcat("captcha=", data, 0, 1);
80                printf("data: %s\n", data);
81
82                free(tmpstr), tmpstr = NULL;
83                tmpstr = gethttps(link, NULL, data, NULL, NULL, link, 1);
84                free(data), data = NULL;
85
86                host = string_resub("http://", "/", link, 0);
87                path = string_replace_all(host, "", link, 0);
88                path = string_replace_all("http://", "", path, 1);
89                path = string_replace_all(" ", "%20", path, 1);
90                titheklog(debuglevel, "/var/usr/local/share/titan/plugins/tithek/tvtoast4a_tmpstr", oitoa(incount), host, path, tmpstr);
91        }
92
93        if(ostrstr(tmpstr, "'file': 'http") != NULL)
94        {
95                streamurl1 = string_resub("'file': 'http", "'", tmpstr, 0);
96                streamurl1 = ostrcat("http", streamurl1, 0, 1);
97                printf("1streamurl1: %s\n", streamurl1);
98        }
99
100        if(ostrstr(tmpstr, "rtmp") == NULL)
101        {
102//    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>");
103                url2 = string_resub("src='", "'", tmpstr, 0);
104                free(tmpstr), tmpstr = NULL;                                           
105                tmpstr = gethttps(url2, NULL, NULL, NULL, NULL, url1, 1);
106                free(host), host = NULL;
107                free(path), path = NULL;
108                host = string_resub("http://", "/", url2, 0);
109                path = string_replace_all(host, "", url2, 0);
110                path = string_replace_all("http://", "", path, 1);
111                path = string_replace_all(" ", "%20", path, 1);
112                titheklog(debuglevel, "/var/usr/local/share/titan/plugins/tithek/tvtoast5_tmpstr", oitoa(incount), host, path, tmpstr);
113        }
114
115        if(ostrstr(tmpstr, "'file': 'http") != NULL)
116        {
117                streamurl1 = string_resub("'file': 'http", "'", tmpstr, 0);
118                streamurl1 = ostrcat("http", streamurl1, 0, 1);
119                printf("2streamurl1: %s\n", streamurl1);
120        }
121
122//streamer: "rtmp:\/\/163.172.8.19:1935\/edge\/_definst_\/?xs=_we_eXVtN2d4emZubWNnYXd0fDE0NDc2ODg2ODR8OTUuOTEuNi4yNXw1NjQ4YTg2Yzg5ZWEwfDVhOTkxZWIzY2JiNzA0NjYyM2Y4ODVlODY0NDhhZTJmNDM0OTc4ODI.",
123        streamer = string_resub("streamer: \"", "\"", tmpstr, 0);
124        streamer = string_replace_all("\\", "", streamer, 1);
125        debug(99, "tvtoast5_tmpstr%d streamer=%s", incount, streamer)
126        if(streamer != NULL)
127        {
128                playpath = string_resub("file: \"", "\"", tmpstr, 0);
129                playpath = string_replace_all(".flv", "", playpath, 1);
130                debug(99, "tvtoast5_tmpstr%d playpath=%s", incount, playpath)
131       
132                swfurl = string_resub("type: 'flash', src: '", "'", tmpstr, 0);
133//              swfurl = string_replace_all("//", "http://", swfurl, 1);
134                debug(99, "tvtoast5_tmpstr%d swfurl=%s", incount, swfurl)
135       
136                app = ostrcat(streamer, NULL, 0, 0);
137                tmpstr1 = string_resub("rtmp://", "/", app, 0);
138                app = string_replace(tmpstr1, "", app, 0);
139                free(tmpstr1), tmpstr1 = NULL;
140                app = string_replace_all("rtmp:///", "", app, 1);
141                debug(99, "tvtoast5_tmpstr%d app5=%s", incount, app)
142
143//$.getJSON("//www.streamlive.to/server.php?id=1447602284", function(json){
144                url3 = string_resub("getJSON(\"", "\"", tmpstr, 0);
145//              url3 = string_replace_all("//", "http://", url3, 1);
146                free(tmpstr), tmpstr = NULL;
147       
148                tmpstr = gethttps(url3, NULL, NULL, NULL, NULL, url2, 1);
149                free(host), host = NULL;
150                free(path), path = NULL;
151                host = string_resub("http://", "/", url3, 0);
152                path = string_replace_all(host, "", url3, 0);
153                path = string_replace_all("http://", "", path, 1);
154                path = string_replace_all(" ", "%20", path, 1);
155                titheklog(debuglevel, "/var/usr/local/share/titan/plugins/tithek/tvtoast6_tmpstr", oitoa(incount), host, path, tmpstr);
156       
157                token = string_resub("{\"token\":\"", "\"", tmpstr, 0);
158                free(tmpstr), tmpstr = NULL;
159
160/*
161        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
162*/
163                if(streamer != NULL)
164                {
165// without app not working
166                        streamurl = ostrcat(streamer, " app=", 0, 0);
167                        streamurl = ostrcat(streamurl, app, 1, 0);
168                        streamurl = ostrcat(streamurl, " playpath=", 1, 0);
169                        streamurl = ostrcat(streamurl, playpath, 1, 0);
170                        streamurl = ostrcat(streamurl, " swfUrl=", 1, 0);
171                        streamurl = ostrcat(streamurl, swfurl, 1, 0);
172                        streamurl = ostrcat(streamurl, " live=1", 1, 0);
173                        streamurl = ostrcat(streamurl, " timeout=15", 1, 0);
174                        streamurl = ostrcat(streamurl, " token=", 1, 0);
175                        streamurl = ostrcat(streamurl, token, 1, 0);
176                        streamurl = ostrcat(streamurl, " pageUrl=", 1, 0);
177                        streamurl = ostrcat(streamurl, url1, 1, 0);
178                }
179        }
180
181        free(streamer), streamer = NULL;
182        free(app), app = NULL;
183        free(playpath), playpath = NULL;
184        free(swfurl), swfurl = NULL;
185        free(token), token = NULL;
186        free(url1), url1 = NULL;
187        free(url2), url2 = NULL;
188        free(url3), url3 = NULL;
189
190        free(host), host = NULL;
191        free(path), path = NULL;
192        free(id), id = NULL;
193
194        debug(99, "streamurl %s", streamurl);
195        return streamurl;
196}
197
198#endif
Note: See TracBrowser for help on using the repository browser.