1 | #ifndef FLASHX_H |
---|
2 | #define FLASHX_H |
---|
3 | |
---|
4 | char* flashx(char* host, char* file) |
---|
5 | { |
---|
6 | debug(99, "in host: %s file: %s", host, file); |
---|
7 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
8 | char* tmphost = NULL; |
---|
9 | char* tmpfile = NULL; |
---|
10 | char* tmpstr = NULL; |
---|
11 | char* send = NULL; |
---|
12 | char* ip = NULL; |
---|
13 | char* streamlink = NULL; |
---|
14 | |
---|
15 | unlink("/tmp/tithek/x9"); |
---|
16 | |
---|
17 | if(host == NULL || file == NULL) return NULL; |
---|
18 | |
---|
19 | tmphost = ostrcat("www.", host, 0, 0); |
---|
20 | tmpfile = ostrcat("/file/", file, 0, 0); |
---|
21 | debug(99, "tmphost: %s", tmphost); |
---|
22 | ip = get_ip(tmphost); |
---|
23 | debug(99, "ip: %s", ip); |
---|
24 | debug(99, "tmpfile: %s", tmpfile); |
---|
25 | debug(99, "file: %s", file); |
---|
26 | |
---|
27 | send = ostrcat(send, "GET /player/embed_player.php?vid=", 1, 0); |
---|
28 | send = ostrcat(send, file, 1, 0); |
---|
29 | send = ostrcat(send, " HTTP/1.1\r\nHost: www.", 1, 0); |
---|
30 | send = ostrcat(send, host, 1, 0); |
---|
31 | 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); |
---|
32 | debug(99, "tmphost: %s", tmphost); |
---|
33 | debug(99, "tmpfile: %s", tmpfile); |
---|
34 | debug(99, "send: %s", send); |
---|
35 | tmpstr = gethttpreal(tmphost, tmpfile, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1); |
---|
36 | |
---|
37 | titheklog(debuglevel, "/tmp/flashx1_tmpstr_get1", NULL, tmpstr); |
---|
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 | titheklog(debuglevel, "/tmp/flashx2_tmpstr_get2", NULL, tmpstr); |
---|
54 | |
---|
55 | free(tmpstr); tmpstr = NULL; |
---|
56 | free(send); send = NULL; |
---|
57 | sleep(1); |
---|
58 | |
---|
59 | send = ostrcat(send, "GET /nuevo/player/cst.php?hash=", 1, 0); |
---|
60 | send = ostrcat(send, file, 1, 0); |
---|
61 | 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); |
---|
62 | debug(99, "tmphost: %s", tmphost); |
---|
63 | debug(99, "tmpfile: %s", tmpfile); |
---|
64 | debug(99, "send: %s", send); |
---|
65 | gethttpreal(tmphost, tmpfile, 80, "/tmp/tithek/x9", NULL, NULL, 0, send, NULL, 5000, 0); |
---|
66 | |
---|
67 | if(!file_exist("/tmp/tithek/x9")) |
---|
68 | { |
---|
69 | 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); |
---|
70 | goto end; |
---|
71 | } |
---|
72 | |
---|
73 | if(debuglevel == 99) system("cp -a /tmp/tithek/x9 /tmp/flashx3_tmpstr_get3"); |
---|
74 | |
---|
75 | free(send); send = NULL; |
---|
76 | tmpstr = command("cat /tmp/tithek/x9 | sed '1,1d' | zcat"); |
---|
77 | |
---|
78 | titheklog(debuglevel, "/tmp/flashx4_tmpstr_get3_zcat", NULL, tmpstr); |
---|
79 | |
---|
80 | streamlink = string_resub("<file>", "</file>", tmpstr, 0); |
---|
81 | titheklog(debuglevel, "/tmp/flashx5_streamlink", NULL, streamlink); |
---|
82 | |
---|
83 | end: |
---|
84 | free(tmphost); tmphost = NULL; |
---|
85 | free(tmpfile); tmpfile = NULL; |
---|
86 | free(tmpstr); tmpstr = NULL; |
---|
87 | free(send); send = NULL; |
---|
88 | free(ip); ip = NULL; |
---|
89 | |
---|
90 | return streamlink; |
---|
91 | } |
---|
92 | |
---|
93 | #endif |
---|