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

Last change on this file since 35507 was 35507, checked in by obi, 9 years ago

fix warnings

File size: 5.1 KB
Line 
1#ifndef FLASHX_H
2#define FLASHX_H
3
4char* flashx(char* link)
5{
6        debug(99, "link: %s", link);
7        int debuglevel = getconfigint("debuglevel", NULL);
8        char* tmphost = NULL, *tmppath = NULL, *tmpstr = NULL, *send = NULL, *streamlink = NULL, *ip = NULL;
9        char* playurl = NULL, *tmpstr2 = NULL, *hash = NULL, *error = NULL;
10        char* app = NULL, *playpath = NULL, *swfUrl = NULL, *pageUrl = NULL, *swfVfy = NULL;
11        char* tmplink = NULL, *pos = NULL, *path = NULL;
12
13        tmplink = ostrcat(link, NULL, 0, 0);
14
15        if(ostrstr(tmplink, "/Out/?s=") != NULL)
16        {
17                tmplink = string_replace("/Out/?s=", "", tmplink, 1);
18                debug(99, "remove out string: %s", tmplink);
19        }
20
21        if(tmplink == NULL || ostrncmp("http://", tmplink, 7))
22        {
23                textbox(_("Message"), _("Hoster Url not http://") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
24                goto end;
25        }
26
27        tmphost = string_replace("http://", "", tmplink, 0);
28        free(tmplink) , tmplink = NULL;
29
30        if(tmphost != NULL)
31                pos = strchr(tmphost, '/');
32        if(pos != NULL)
33        {
34                pos[0] = '\0';
35                path = pos + 1;
36        }
37
38        tmppath = ostrcat("/embed-", path, 0, 0);
39        tmphost = string_replace("www.", "", tmphost, 0);
40
41        send = ostrcat(send, "GET ", 1, 0);
42        send = ostrcat(send, tmppath, 1, 0);
43        send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);     
44        send = ostrcat(send, tmphost, 1, 0);
45        send = ostrcat(send, "\r\n", 1, 0);     
46        send = ostrcat(send, "User-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);     
47        send = ostrcat(send, "Referer: http://flashx.tv", 1, 0);
48        send = ostrcat(send, tmppath, 1, 0);
49        send = ostrcat(send, "\r\n", 1, 0);     
50        send = ostrcat(send, "Connection: close\r\n", 1, 0);   
51        send = ostrcat(send, "Accept-Encoding: gzip\r\n\r\n", 1, 0);   
52
53        debug(99, "#############################################################################################################");
54        debug(99, "send1: %s", send);
55        debug(99, "#############################################################################################################");
56
57        tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
58        debug(99, "tmpstr: %s", tmpstr);
59        titheklog(debuglevel, "/tmp/flashx_tmpstr_get1", NULL, NULL, NULL, tmpstr);
60
61        if(tmpstr == NULL || ostrstr(tmpstr, "<center>Video not found, deleted or abused, sorry!<br") != NULL)
62        {
63                error = string_resub("<li> <center>", "<br", tmpstr, 0);
64                string_deltags(error);
65                error = strstrip(error);
66                if(error == NULL || strlen(error) == 0)
67                        error = ostrcat(_("The page is temporarily unavailable"), NULL, 0, 0);
68                textbox(_("Message"), error, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 400, 0, 0);
69                goto end;
70        }
71
72//      tmpstr2 = oregex(".*(luq4qk.*)\|.*", tmpstr);
73        tmpstr2 = string_resub("|luq4", "|", tmpstr, 0);
74        tmpstr2 = ostrcat("/luq4", tmpstr2, 0, 1);
75        tmpstr2 = ostrcat(tmpstr2, ".smil", 1, 0);
76        free(tmpstr), tmpstr = NULL;
77        free(send), send = NULL;
78
79        send = ostrcat(send, "GET ", 1, 0);
80        send = ostrcat(send, tmpstr2, 1, 0);
81        send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);     
82        send = ostrcat(send, tmphost, 1, 0);
83        send = ostrcat(send, "\r\n", 1, 0);     
84        send = ostrcat(send, "User-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);     
85        send = ostrcat(send, "Referer: http://flashx.tv", 1, 0);
86        send = ostrcat(send, tmppath, 1, 0);
87        send = ostrcat(send, "\r\n", 1, 0);     
88        send = ostrcat(send, "Connection: close\r\n", 1, 0);   
89        send = ostrcat(send, "Accept-Encoding: gzip\r\n\r\n", 1, 0);   
90
91        debug(99, "#############################################################################################################");
92        debug(99, "send2: %s", send);
93        debug(99, "#############################################################################################################");
94
95        tmpstr = gethttpreal(tmphost, tmpstr2, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
96        debug(99, "tmpstr: %s", tmpstr);
97        titheklog(debuglevel, "/tmp/flashx_tmpstr_get2", NULL, NULL, NULL, tmpstr);
98
99        playurl = string_resub("<meta base=\"", "vod/\"", tmpstr, 0);
100        app = ostrcat("vod/", NULL, 0, 0);
101        playpath = string_resub("<video src=\"", "\"", tmpstr, 0);
102        swfUrl= ostrcat("http://static.flashx.tv/player6/jwplayer.flash.swf", NULL, 0, 0);
103        pageUrl = ostrcat(link, NULL, 0, 0);
104        swfVfy = ostrcat("true", NULL, 0, 0);
105       
106        streamlink = ostrcat(streamlink, playurl, 1, 0);
107        streamlink = ostrcat(streamlink, " app=", 1, 0);
108        streamlink = ostrcat(streamlink, app, 1, 0);
109        streamlink = ostrcat(streamlink, " playpath=", 1, 0);
110        streamlink = ostrcat(streamlink, playpath, 1, 0);
111        streamlink = ostrcat(streamlink, " swfUrl=", 1, 0);
112        streamlink = ostrcat(streamlink, swfUrl, 1, 0);
113        streamlink = ostrcat(streamlink, " pageUrl=", 1, 0);
114        streamlink = ostrcat(streamlink, pageUrl, 1, 0);
115        streamlink = ostrcat(streamlink, " swfVfy=", 1, 0);
116        streamlink = ostrcat(streamlink, swfVfy, 1, 0);
117
118        titheklog(debuglevel, "flashx_streamlink", NULL, NULL, NULL, tmpstr);
119
120end:
121        free(error); error = NULL;
122        free(tmphost); tmphost = NULL;
123        free(tmphost); tmphost = NULL;
124        free(tmpstr); tmpstr = NULL;
125        free(send); send = NULL;
126        free(ip); ip = NULL;
127
128        return streamlink;
129}
130
131#endif
Note: See TracBrowser for help on using the repository browser.