source: titan/plugins/tithek/flashx.h @ 24252

Last change on this file since 24252 was 24252, checked in by obi, 10 years ago

[tithek] fix flashx hoster

File size: 9.2 KB
Line 
1#ifndef FLASHX_H
2#define FLASHX_H
3
4char* flashx(char* host, char* file, char* hosterurl)
5{
6        debug(99, "host: %s file: %s", host, file);
7        debug(99, "hosterurl: %s", hosterurl);
8        char* tmphost = NULL;
9        char* tmppath = NULL;
10        char* tmpstr = NULL;
11        char* send = NULL;
12        char* streamlink = NULL;
13        char* ip = NULL, *pos = NULL, *path = NULL;
14
15        if(host == NULL || file == NULL) return NULL;
16
17        ip = string_replace("http://", "", (char*)hosterurl, 0);
18
19        if(ip != NULL)
20                pos = strchr(ip, '/');
21        if(pos != NULL)
22        {
23                pos[0] = '\0';
24                path = pos + 1;
25        }
26       
27        tmphost = ostrcat(ip, NULL, 0, 0);
28        tmppath = ostrcat("/", path, 0, 0);
29       
30//printf("\n#######################################################\n");
31//printf("GET /video/UX98AKXU2ARB/RiddickUeberlebenistseineRacheTSLDGermanX264-AOE\n");
32//printf("tmphost: %s\n",tmphost);
33//printf("tmppath: %s\n",tmppath);
34//printf("\n#######################################################\n");
35        send = ostrcat(send, "GET ", 1, 0);
36        send = ostrcat(send, tmppath, 1, 0);
37        send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);     
38        send = ostrcat(send, tmphost, 1, 0);
39        send = ostrcat(send, "\r\nUser-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.99 Safari/535.1\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n", 1, 0);       
40        debug(99, "send: %s", send);
41        tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
42        if(getconfigint("debuglevel", NULL) == 99)
43                writesys("/tmp/flashx_tmpstr_get1", tmpstr, 0);
44//      writesys("/var/usr/local/share/titan/plugins/tithek//flashx_tmpstr_get1", tmpstr, 0);
45//printf("\n#######################################################\n");
46
47        char* cookie1 = string_resub("Set-Cookie: pageredir=", ";", tmpstr, 0);
48        debug(99, "cookie1: %s", cookie1);
49
50        char* cookie2 = string_resub("Set-Cookie: PHPSESSID=", ";", tmpstr, 0);
51        debug(99, "cookie2: %s", cookie2);
52
53        char* cookie3 = string_resub("Set-Cookie: video_", "=", tmpstr, 0);
54        debug(99, "cookie3: %s", cookie3);
55       
56        free(tmppath), tmppath = NULL;
57        tmppath = ostrcat("/player/embed.php?vid=", cookie3, 0, 0);
58        free(tmphost), tmphost = NULL;
59        char* tmphost1 = oregex(".*<iframe width=.*src=\"(http://.*)&width.*", tmpstr);
60        tmphost = string_resub("http://", "/", tmphost1, 0);
61        free(tmphost1), tmphost1 = NULL;
62        free(tmpstr); tmpstr = NULL;
63        free(send); send = NULL;
64//      sleep(1);
65//printf("\n#######################################################\n");
66//printf("GET /player/embed.php?vid=1008580\n");
67//printf("tmphost: %s\n",tmphost);
68//printf("tmppath: %s\n",tmppath);
69//printf("\n#######################################################\n");
70        send = ostrcat(send, "GET ", 1, 0);
71        send = ostrcat(send, tmppath, 1, 0);
72        send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);     
73        send = ostrcat(send, tmphost, 1, 0);   
74        send = ostrcat(send, "\r\nUser-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.99 Safari/535.1\r\n", 1, 0);
75
76        send = ostrcat(send, "Cookie: pageredir=", 1, 0);       
77        send = ostrcat(send, cookie1, 1, 0);
78        send = ostrcat(send, "; PHPSESSID=", 1, 0);     
79        send = ostrcat(send, cookie2, 1, 0);   
80        send = ostrcat(send, "\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n", 1, 0);   
81        debug(99, "send: %s", send);
82        tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
83
84        if(getconfigint("debuglevel", NULL) == 99)
85                writesys("/tmp/flashx_tmpstr_get2", tmpstr, 0);
86//      writesys("/var/usr/local/share/titan/plugins/tithek//flashx_tmpstr_get2", tmpstr, 0);
87//printf("\n#######################################################\n");
88
89        char* hash1tmp = string_resub("<input type=\"hidden\" name=\"sec\" value=\"", "\"", tmpstr, 0);
90        char* hash2tmp = string_resub("<input type=\"hidden\" name=\"id\" value=\"", "\"", tmpstr, 0);
91       
92        char* hash1 = htmlencode(hash1tmp);
93        char* hash2 = htmlencode(hash2tmp);
94       
95        // htmldecod cant / to %2f
96//      hash1 = string_replace_all("/", "%2F", hash1, 1);
97//      hash2 = string_replace_all("/", "%2F", hash2, 1);
98
99        char* hash = ostrcat("sec=", hash1, 0, 0);
100        hash = ostrcat(hash, "&id=", 0, 0);
101        hash = ostrcat(hash, hash2, 0, 0);
102        char* hashlen = NULL;
103        hashlen = oitoa(strlen(hash));
104        debug(99, "hashlen: %s", hashlen);
105
106        free(tmpstr); tmpstr = NULL;
107        free(send); send = NULL;
108//      sleep(1);
109
110//printf("\n#######################################################\n");
111//printf("POST /player/show.php\n");
112//printf("\n#######################################################\n");       
113
114        send = ostrcat(send, "POST /player/show.php HTTP/1.1\r\nContent-Length: ", 1, 0);
115        send = ostrcat(send, hashlen, 1, 0);
116        send = ostrcat(send, "\r\nAccept-Encoding: gzip\r\nConnection: close\r\nUser-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.99 Safari/535.1\r\nHost: ", 1, 0);
117        send = ostrcat(send, tmphost, 1, 0);
118        send = ostrcat(send, "\r\nCookie: pageredir=", 1, 0);
119        send = ostrcat(send, cookie1, 1, 0);
120        send = ostrcat(send, "; PHPSESSID=", 1, 0);     
121        send = ostrcat(send, cookie2, 1, 0);
122        send = ostrcat(send, "\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n", 1, 0);     
123        send = ostrcat(send, hash, 1, 0);
124
125        debug(99, "send: %s", send);
126        tmpstr = gethttpreal(tmphost, "/player/show.php", 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
127
128        if(getconfigint("debuglevel", NULL) == 99)
129                writesys("/tmp/flashx_tmpstr_get3", tmpstr, 0);
130//      writesys("/var/usr/local/share/titan/plugins/tithek//flashx_tmpstr_get3", tmpstr, 0);
131//printf("\n#######################################################\n");
132//var code ='<object id="nuevoplayer" width="'+ww+'" height="'+hh+'" data="http://play.flashx.tv/nuevo/player/player.swf?config=http://play.flashx.tv/nuevo/player/play.php?str=4MfrzrW4qrPKnM2dw5/Fvcs=" type="application/x-shockwave-flash">';
133        char* playurl = string_resub("?config=", "\"", tmpstr, 0);
134        free(tmppath), tmppath = NULL;
135        tmppath = ostrcat("/nuevo/player/player.swf?config=", playurl, 0, 0);
136//      free(playurl), playurl = NULL;
137
138        free(tmpstr); tmpstr = NULL;
139        free(send); send = NULL;
140//      sleep(1);
141
142//printf("\n#######################################################\n");
143//printf("GET /nuevo/player/player.swf?config=http://play.flashx.tv/nuevo/player/play.php?str=4MfrzrW70J.wp8O.zZi5uLo=\n");
144//printf("tmphost: %s\n",tmphost);
145//printf("tmppath: %s\n",tmppath);
146//printf("\n#######################################################\n");       
147
148        send = ostrcat(send, "GET ", 1, 0);
149        send = ostrcat(send, tmppath, 1, 0);
150        send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);     
151        send = ostrcat(send, tmphost, 1, 0);
152        send = ostrcat(send, "\r\nUser-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.99 Safari/535.1\r\n", 1, 0);
153        send = ostrcat(send, "Cookie: pageredir=", 1, 0);       
154        send = ostrcat(send, cookie1, 1, 0);
155        send = ostrcat(send, "; PHPSESSID=", 1, 0);     
156        send = ostrcat(send, cookie2, 1, 0);   
157        send = ostrcat(send, "\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n", 1, 0);   
158
159
160        debug(99, "send: %s", send);
161        tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
162
163        if(getconfigint("debuglevel", NULL) == 99)
164                writesys("/tmp/flashx_tmpstr_get4", tmpstr, 0);
165//      writesys("/var/usr/local/share/titan/plugins/tithek//flashx_tmpstr_get4", tmpstr, 0);
166//printf("\n#######################################################\n");
167
168
169
170//printf("tmppath: %s\n",tmppath);
171//printf("playurl: %s\n",playurl);
172        free(tmppath), tmppath = NULL;
173//      tmppath = ostrcat("/nuevo/player/play.php?str=4MfrzrW4qrPKnM2dw5/Fvcs=", NULL, 0, 0);
174//      tmppath = string_resub("/play.php?", "\0", tmpstr, 0);
175        char* tmpstr2 = ostrcat("http://", tmphost, 0, 0);
176        tmppath = string_replace(tmpstr2, "", playurl, 0);
177
178        free(tmpstr2); tmpstr2 = NULL;         
179        free(playurl), playurl = NULL;
180        free(tmpstr); tmpstr = NULL;
181        free(send); send = NULL;
182//      sleep(1);
183       
184//printf("\n#######################################################\n");
185//printf("GET /nuevo/player/play.php?str=4MfrzrW70J.wp8O.zZi5uLo=\n");
186//printf("tmphost: %s\n",tmphost);
187//printf("tmppath: %s\n",tmppath);
188
189//printf("\n#######################################################\n");       
190
191        send = ostrcat(send, "GET ", 1, 0);
192        send = ostrcat(send, tmppath, 1, 0);
193        send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);     
194        send = ostrcat(send, tmphost, 1, 0);
195        send = ostrcat(send, "\r\nUser-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.99 Safari/535.1\r\n", 1, 0);
196        send = ostrcat(send, "Cookie: pageredir=", 1, 0);       
197        send = ostrcat(send, cookie1, 1, 0);
198        send = ostrcat(send, "; PHPSESSID=", 1, 0);     
199        send = ostrcat(send, cookie2, 1, 0);   
200        send = ostrcat(send, "\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n", 1, 0);   
201
202
203        debug(99, "send: %s", send);
204        tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
205
206        if(getconfigint("debuglevel", NULL) == 99)
207                writesys("/tmp/flashx_tmpstr_get5", tmpstr, 0);
208//      writesys("/var/usr/local/share/titan/plugins/tithek//flashx_tmpstr_get5", tmpstr, 0);
209//printf("\n#######################################################\n");
210
211        streamlink = string_resub("<file>", "</file>", tmpstr, 0);
212        if(getconfigint("debuglevel", NULL) == 99)
213                writesys("/tmp/flashx5_streamlink", streamlink, 0);
214
215//end:
216        free(tmphost); tmphost = NULL;
217        free(tmphost); tmphost = NULL;
218        free(tmpstr); tmpstr = NULL;
219        free(send); send = NULL;
220        free(ip); ip = NULL;
221
222        return streamlink;
223}
224
225#endif
Note: See TracBrowser for help on using the repository browser.