source: titan/plugins/tithek/movshare.h @ 26912

Last change on this file since 26912 was 24457, checked in by nit, 10 years ago

fix

File size: 4.7 KB
Line 
1#ifndef MOVESHARE_H
2#define MOVESHARE_H
3
4char* movshare(char* link)
5{
6        debug(99, "link: %s", link);
7        int debuglevel = getconfigint("debuglevel", NULL);
8        char* tmphost = NULL;
9        char* tmppath = NULL;
10        char* tmpstr = NULL;
11        char* send = NULL;
12        char* ip = NULL;
13        char* streamlink = NULL;
14        char* filekey = NULL;
15        char* file = NULL;
16       
17        if(link == NULL) return NULL;
18
19        unlink("/tmp/movshare1_get");
20        unlink("/tmp/movshare2_get");
21/////////////
22        char* tmplink = NULL, *pos = NULL, *path = NULL;
23
24        tmplink = ostrcat(link, NULL, 0, 0);
25
26        if(ostrstr(link, "/Out/?s=") != NULL)
27        {
28                tmplink = string_replace("/Out/?s=", "", tmplink, 1);
29                debug(99, "remove out string: %s", tmplink);
30        }
31       
32
33        if(tmplink == NULL || ostrncmp("http://", tmplink, 7))
34        {
35                textbox(_("Message"), _("Hoster Url not http://") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
36                goto end;
37        }
38
39        tmphost = string_replace("http://", "", tmplink, 0);
40        free(tmplink) , tmplink = NULL;
41
42        if(tmphost != NULL)
43                pos = strchr(tmphost, '/');
44        if(pos != NULL)
45        {
46                pos[0] = '\0';
47                path = pos + 1;
48        }
49
50        tmppath = ostrcat("/", path, 0, 0);
51//      free(path), path = NULL;
52
53/////////////
54
55/////////////
56        char* host = NULL;
57        host = ostrcat(tmphost, NULL, 0, 0);
58        tmppath = string_replace("/video/", "/embed.php?v=", tmppath, 1);
59        free(tmphost), tmphost = NULL;
60        tmphost = ostrcat("embed.movshare.net", NULL, 0, 0);
61/////////////
62/*
63        tmppath = ostrcat("/embed.php?v=", file, 0, 0);
64        tmphost = ostrcat("embed.movshare.net", NULL, 0, 0);
65*/
66        send = ostrcat(send, "GET ", 1, 0);
67        send = ostrcat(send, tmppath, 1, 0);
68        send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);
69        send = ostrcat(send, tmphost, 1, 0);
70        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);
71        debug(99, "send: %s", send);
72
73        tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
74        debug(99, "tmpstr: %s", tmpstr);
75        titheklog(debuglevel, "/tmp/movshare1_get", NULL, tmpstr);
76       
77        file = string_replace("/embed.php?v=", "", tmppath, 0);
78        if(file == NULL)
79                file = string_resub("flashvars.file=\"", "\";", tmpstr, 0);
80       
81        char* r1 = NULL, *r2 = NULL, *r3 = NULL, *r4 = NULL;
82        pos = ostrstr(tmpstr, ");}('");
83        if(pos != NULL)
84        {
85                r1 = string_resub(");}('", "'", pos, 0);
86                pos = ostrstr(pos + 5, ",'");
87                if(pos != NULL)
88                {
89                        r2 = string_resub(",'", "'", pos, 0);
90                        pos = ostrstr(pos + 2, ",'");
91                        if(pos != NULL)
92                        {
93                                r3 = string_resub(",'", "'", pos, 0);
94                                pos = ostrstr(pos + 2, ",'");
95                                if(pos != NULL)
96                                        r4 = string_resub(",'", "'", pos, 0);
97                        }
98                }
99        }
100       
101        filekey = getfilekey(r1, r2, r3, r4);
102       
103        free(r1); r1 = NULL;
104        free(r2); r2 = NULL;
105        free(r3); r3 = NULL;
106        free(r4); r4 = NULL;
107       
108        if(filekey == NULL)
109                filekey = string_resub("flashvars.filekey=\"", "\";", tmpstr, 0);
110
111        if(filekey == NULL)
112        {
113                char* searchstr = string_resub("flashvars.filekey=", ";", tmpstr, 0);
114                debug(99, "searchstr: %s", searchstr);
115                searchstr = ostrcat(searchstr, "=\"", 1, 0);
116                filekey = string_resub(searchstr, "\";", tmpstr, 0);
117        }
118
119        debug(99, "filekey: %s", filekey);
120        debug(99, "file: %s", file);
121       
122        free(tmpstr), tmpstr = NULL;
123        free(tmppath), tmppath = NULL;
124//      free(tmphost), tmphost = NULL;
125        free(send), send = NULL;
126       
127        tmppath = ostrcat("/api/player.api.php?file=", file, 0, 0);
128        tmppath = ostrcat(tmppath, "&key=", 1, 0);
129        tmppath = ostrcat(tmppath, filekey, 1, 0);
130//      tmphost = ostrcat(tmphost, NULL, 0, 0);
131       
132        free(tmphost), tmphost = NULL;
133        tmphost = ostrcat(host, NULL, 0, 0);
134
135        free(send), send = NULL;
136        send = ostrcat(send, "GET ", 1, 0);
137        send = ostrcat(send, tmppath, 1, 0);
138        send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);
139        send = ostrcat(send, tmphost, 1, 0);
140        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);
141        debug(99, "send: %s", send);
142        free(tmpstr), tmpstr = NULL;
143        tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
144        debug(99, "tmpstr: %s", tmpstr);
145        titheklog(debuglevel, "/tmp/movshare2_get", NULL, tmpstr);
146
147        if(tmpstr == NULL)
148        {
149                textbox(_("Message"), _("The page is temporarily unavailable") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
150                goto end;
151        }
152
153        streamlink = string_resub("url=", "&", tmpstr, 0);
154end:
155        free(tmphost); tmphost = NULL;
156        free(tmppath); tmppath = NULL;
157        free(tmpstr); tmpstr = NULL;
158        free(send); send = NULL;
159        free(filekey); filekey = NULL;
160        free(ip); ip = NULL;
161
162        return streamlink;
163}
164
165#endif
Note: See TracBrowser for help on using the repository browser.