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

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

fix

File size: 3.4 KB
Line 
1#ifndef FLASHX_H
2#define FLASHX_H
3
4char* flashx(char* host, char* file)
5{
6        debug(99, "in host: %s file: %s", host, file);
7        char* tmphost = NULL;
8        char* tmpfile = NULL;
9        char* tmpstr = NULL;
10        char* send = NULL;
11        char* ip = NULL;
12        char* streamlink = NULL;
13
14        unlink("/tmp/tithek/x9");
15
16        if(host == NULL || file == NULL) return NULL;
17
18        tmphost = ostrcat("www.", host, 0, 0);
19        tmpfile = ostrcat("/file/", file, 0, 0);
20        debug(99, "tmphost: %s", tmphost);
21        ip = get_ip(tmphost);
22        debug(99, "ip: %s", ip);
23        debug(99, "tmpfile: %s", tmpfile);
24        debug(99, "file: %s", file);
25
26        send = ostrcat(send, "GET /player/embed_player.php?vid=", 1, 0);
27        send = ostrcat(send, file, 1, 0);
28        send = ostrcat(send, " HTTP/1.1\r\nHost: www.", 1, 0); 
29        send = ostrcat(send, host, 1, 0);
30        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);       
31        debug(99, "tmphost: %s", tmphost);
32        debug(99, "tmpfile: %s", tmpfile);
33        debug(99, "send: %s", send);
34        tmpstr = gethttpreal(tmphost, tmpfile, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
35
36        if(getconfigint("debuglevel", NULL) == 99)
37                writesys("/tmp/flashx1_tmpstr_get1", tmpstr, 0);
38
39        free(tmpstr); tmpstr = NULL;
40        free(send); send = NULL;
41        sleep(1);
42
43        send = ostrcat(send, "GET /player/embed_player.php?vid=", 1, 0);
44        send = ostrcat(send, file, 1, 0);
45        send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);     
46        send = ostrcat(send, host, 1, 0);
47        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);       
48        debug(99, "tmphost: %s", tmphost);
49        debug(99, "tmpfile: %s", tmpfile);
50        debug(99, "send: %s", send);
51        tmpstr = gethttpreal(tmphost, tmpfile, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
52
53        if(getconfigint("debuglevel", NULL) == 99)
54                writesys("/tmp/flashx2_tmpstr_get2", tmpstr, 0);
55
56        free(tmpstr); tmpstr = NULL;
57        free(send); send = NULL;
58        sleep(1);
59
60        send = ostrcat(send, "GET /nuevo/player/cst.php?hash=", 1, 0);
61        send = ostrcat(send, file, 1, 0);
62        send = ostrcat(send, " HTTP/1.1\r\nHost: play.flashx.tv\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);       
63        debug(99, "tmphost: %s", tmphost);
64        debug(99, "tmpfile: %s", tmpfile);
65        debug(99, "send: %s", send);
66        gethttpreal(tmphost, tmpfile, 80, "/tmp/tithek/x9", NULL, NULL, 0, send, NULL, 5000, 0);
67
68        if(!file_exist("/tmp/tithek/x9"))
69        {
70                textbox(_("Message"), _("This file doesn't exist, or has been removed") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
71                goto end;
72        }
73
74        if(getconfigint("debuglevel", NULL) == 99)
75                system("cp -a /tmp/tithek/x9 /tmp/flashx3_tmpstr_get3");
76
77        free(send); send = NULL;
78        tmpstr = command("cat /tmp/tithek/x9 | sed '1,1d' | zcat");
79
80        if(getconfigint("debuglevel", NULL) == 99)
81                writesys("/tmp/flashx4_tmpstr_get3_zcat", tmpstr, 0);
82
83        streamlink = string_resub("<file>", "</file>", tmpstr, 0);
84        if(getconfigint("debuglevel", NULL) == 99)
85                writesys("/tmp/flashx5_streamlink", streamlink, 0);
86
87end:
88        free(tmphost); tmphost = NULL;
89        free(tmpfile); tmpfile = NULL;
90        free(tmpstr); tmpstr = NULL;
91        free(send); send = NULL;
92        free(ip); ip = NULL;
93
94        return streamlink;
95}
96
97#endif
Note: See TracBrowser for help on using the repository browser.