1 | #ifndef NOVAMOV_H |
---|
2 | #define NOVAMOV_H |
---|
3 | |
---|
4 | char* novamov(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/novamov1_get"); |
---|
20 | unlink("/tmp/novamov2_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, 4)) |
---|
34 | { |
---|
35 | textbox(_("Message"), _("Hoster Url not http:// or https://") , _("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 | tmphost = string_replace("https://", "", tmphost, 1); |
---|
41 | free(tmplink) , tmplink = NULL; |
---|
42 | |
---|
43 | if(tmphost != NULL) |
---|
44 | pos = strchr(tmphost, '/'); |
---|
45 | if(pos != NULL) |
---|
46 | { |
---|
47 | pos[0] = '\0'; |
---|
48 | path = pos + 1; |
---|
49 | } |
---|
50 | |
---|
51 | tmppath = ostrcat("/", path, 0, 0); |
---|
52 | // free(path), path = NULL; |
---|
53 | |
---|
54 | ///////////// |
---|
55 | |
---|
56 | |
---|
57 | /* |
---|
58 | tmphost = ostrcat("www.", host, 0, 0); |
---|
59 | tmphost = ostrcat(tmphost, ".com", 1, 0); |
---|
60 | |
---|
61 | tmppath = ostrcat("/video/", file, 0, 0); |
---|
62 | |
---|
63 | debug(99, "tmphost: %s", tmphost); |
---|
64 | ip = get_ip(tmphost); |
---|
65 | debug(99, "ip: %s", ip); |
---|
66 | debug(99, "tmppath: %s", tmppath); |
---|
67 | */ |
---|
68 | |
---|
69 | if(ostrstr(link, "http://file.") != NULL) |
---|
70 | tmphost = string_replace("file.", "www.", tmphost, 1); |
---|
71 | |
---|
72 | if(ostrstr(link, "http://embed.") != NULL) |
---|
73 | tmphost = string_replace("embed.", "www.", tmphost, 1); |
---|
74 | |
---|
75 | if(ostrstr(link, "embed.php?v=") != NULL) |
---|
76 | { |
---|
77 | tmppath = string_replace("embed.php?v=", "video/", tmppath, 1); |
---|
78 | tmppath = stringreplacecharonce(tmppath, '&', '\0'); |
---|
79 | } |
---|
80 | |
---|
81 | if(ostrstr(link, "auroravid.to/video/") != NULL) |
---|
82 | tmppath = string_replace("/video/", "/embed/?v=", tmppath, 1); |
---|
83 | |
---|
84 | send = ostrcat(send, "GET ", 1, 0); |
---|
85 | send = ostrcat(send, tmppath, 1, 0); |
---|
86 | send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0); |
---|
87 | send = ostrcat(send, tmphost, 1, 0); |
---|
88 | 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); |
---|
89 | debug(99, "send: %s", send); |
---|
90 | |
---|
91 | tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1); |
---|
92 | debug(99, "tmpstr: %s", tmpstr); |
---|
93 | titheklog(debuglevel, "/tmp/novamov1_get", NULL, NULL, NULL, tmpstr); |
---|
94 | |
---|
95 | if(ostrstr(tmpstr, "The file is being transfered to our other servers. This may take few minutes.") != NULL) |
---|
96 | { |
---|
97 | textbox(_("Message"), _("The file is being transfered to our other servers. This may take few minutes.") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0); |
---|
98 | goto end; |
---|
99 | } |
---|
100 | |
---|
101 | if(ostrstr(tmpstr, "This file no longer exists on our servers!") != NULL) |
---|
102 | { |
---|
103 | textbox(_("Message"), _("This file no longer exists on our servers!") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0); |
---|
104 | goto end; |
---|
105 | } |
---|
106 | |
---|
107 | file = string_resub("flashvars.file=\"", "\";", tmpstr, 0); |
---|
108 | if(file == NULL) |
---|
109 | file = string_replace("/video/", "", tmppath, 0); |
---|
110 | if(file == NULL) |
---|
111 | file = string_resub("login.php?return=/video/", "\"", tmpstr, 0); |
---|
112 | if(file == NULL) |
---|
113 | file = string_resub("<a href=\"/share.php?id=", "&title=", tmpstr, 0); |
---|
114 | |
---|
115 | char* r1 = NULL, *r2 = NULL, *r3 = NULL, *r4 = NULL; |
---|
116 | pos = ostrstr(tmpstr, ");}('"); |
---|
117 | if(pos != NULL) |
---|
118 | { |
---|
119 | r1 = string_resub(");}('", "'", pos, 0); |
---|
120 | pos = ostrstr(pos + 5, ",'"); |
---|
121 | if(pos != NULL) |
---|
122 | { |
---|
123 | r2 = string_resub(",'", "'", pos, 0); |
---|
124 | pos = ostrstr(pos + 2, ",'"); |
---|
125 | if(pos != NULL) |
---|
126 | { |
---|
127 | r3 = string_resub(",'", "'", pos, 0); |
---|
128 | pos = ostrstr(pos + 2, ",'"); |
---|
129 | if(pos != NULL) |
---|
130 | r4 = string_resub(",'", "'", pos, 0); |
---|
131 | } |
---|
132 | } |
---|
133 | } |
---|
134 | |
---|
135 | filekey = getfilekey(r1, r2, r3, r4); |
---|
136 | |
---|
137 | free(r1); r1 = NULL; |
---|
138 | free(r2); r2 = NULL; |
---|
139 | free(r3); r3 = NULL; |
---|
140 | free(r4); r4 = NULL; |
---|
141 | |
---|
142 | if(filekey == NULL) |
---|
143 | filekey = string_resub("flashvars.filekey=\"", "\";", tmpstr, 0); |
---|
144 | |
---|
145 | if(filekey == NULL) |
---|
146 | { |
---|
147 | char* searchstr = string_resub("flashvars.filekey=", ";", tmpstr, 0); |
---|
148 | debug(99, "searchstr: %s", searchstr); |
---|
149 | searchstr = ostrcat(searchstr, "=\"", 1, 0); |
---|
150 | filekey = string_resub(searchstr, "\";", tmpstr, 0); |
---|
151 | } |
---|
152 | |
---|
153 | debug(99, "filekey: %s", filekey); |
---|
154 | |
---|
155 | free(tmppath), tmppath = NULL; |
---|
156 | tmppath = ostrcat("/api/player.api.php?file=", file, 0, 0); |
---|
157 | tmppath = ostrcat(tmppath, "&key=", 1, 0); |
---|
158 | tmppath = ostrcat(tmppath, filekey, 1, 0); |
---|
159 | |
---|
160 | free(send), send = NULL; |
---|
161 | send = ostrcat(send, "GET ", 1, 0); |
---|
162 | send = ostrcat(send, tmppath, 1, 0); |
---|
163 | send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0); |
---|
164 | send = ostrcat(send, tmphost, 1, 0); |
---|
165 | 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); |
---|
166 | debug(99, "send: %s", send); |
---|
167 | free(tmpstr), tmpstr = NULL; |
---|
168 | tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1); |
---|
169 | debug(99, "tmpstr: %s", tmpstr); |
---|
170 | titheklog(debuglevel, "/tmp/novamov2_get", NULL, NULL, NULL, tmpstr); |
---|
171 | |
---|
172 | streamlink = string_resub("url=", "&", tmpstr, 0); |
---|
173 | debug(99, "streamlink1: %s", streamlink); |
---|
174 | htmldecode(streamlink, streamlink); |
---|
175 | debug(99, "streamlink2: %s", streamlink); |
---|
176 | |
---|
177 | end: |
---|
178 | free(tmphost); tmphost = NULL; |
---|
179 | free(tmppath); tmppath = NULL; |
---|
180 | free(tmpstr); tmpstr = NULL; |
---|
181 | free(send); send = NULL; |
---|
182 | free(filekey); filekey = NULL; |
---|
183 | free(ip); ip = NULL; |
---|
184 | |
---|
185 | return streamlink; |
---|
186 | } |
---|
187 | |
---|
188 | #endif |
---|