1 | #ifndef KINOX_H |
---|
2 | #define KINOX_H |
---|
3 | |
---|
4 | // flag 1 = putlocker/sockshare |
---|
5 | // flag 2 = filenuke |
---|
6 | |
---|
7 | char* kinox(char* link) |
---|
8 | { |
---|
9 | debug(99, "link: %s", link); |
---|
10 | char* streamurl = NULL; |
---|
11 | |
---|
12 | streamurl = hoster(link); |
---|
13 | // debug(99, "streamurl1: %s", streamurl); |
---|
14 | |
---|
15 | // streamurl = string_replace_all("amp;", "", streamurl, 1); |
---|
16 | // debug(99, "streamurl2: %s", streamurl); |
---|
17 | |
---|
18 | return streamurl; |
---|
19 | } |
---|
20 | |
---|
21 | int kinox_search(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title, char* searchstr, int flag) |
---|
22 | { |
---|
23 | int ret = 1; |
---|
24 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
25 | |
---|
26 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
27 | return ret; |
---|
28 | |
---|
29 | char* search = NULL; |
---|
30 | if(flag == 0) |
---|
31 | { |
---|
32 | if(searchstr == NULL) |
---|
33 | search = textinputhist(_("Search"), " ", "searchhist"); |
---|
34 | else |
---|
35 | search = textinputhist(_("Search"), searchstr, "searchhist"); |
---|
36 | } |
---|
37 | else |
---|
38 | search = ostrcat(link, NULL, 0, 0); |
---|
39 | |
---|
40 | if(search != NULL) |
---|
41 | { |
---|
42 | drawscreen(load, 0, 0); |
---|
43 | char* tmpstr = NULL; |
---|
44 | char* tmpstr1 = NULL; |
---|
45 | char* line = NULL; |
---|
46 | char* pic = NULL; |
---|
47 | char* title = NULL; |
---|
48 | char* lang = NULL; |
---|
49 | char* langck = NULL; |
---|
50 | char* from = NULL; |
---|
51 | char* url = NULL; |
---|
52 | char* ip = NULL; |
---|
53 | char* path = NULL; |
---|
54 | char* menu = NULL; |
---|
55 | char* newurl = NULL; |
---|
56 | char *cmd = NULL; |
---|
57 | |
---|
58 | search = strstrip(search); |
---|
59 | search = stringreplacechar(search, ' ', '+'); |
---|
60 | debug(99, "search: %s", search); |
---|
61 | |
---|
62 | if(flag == 0) |
---|
63 | path = ostrcat("Search.html?q=", search, 0, 0); |
---|
64 | else |
---|
65 | { |
---|
66 | path = ostrcat(search, NULL, 0, 0); |
---|
67 | // path = string_replace_all("kinox.to", "", path, 0); |
---|
68 | // path = string_replace_all(getconfig("tithek_kinox_url", NULL), "", path, 0); |
---|
69 | // path = string_replace_all("http:///", "", path, 0); |
---|
70 | // path = string_replace_all("https:///", "", path, 0); |
---|
71 | } |
---|
72 | // tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0); |
---|
73 | newurl = ostrcat(getconfig("tithek_kinox_url", NULL), "/", 0, 0); |
---|
74 | newurl = ostrcat(newurl, path, 1, 0); |
---|
75 | // tmpstr = gethttps(newurl, NULL, NULL, NULL, NULL, NULL, 1); |
---|
76 | // new start |
---|
77 | cmd = ostrcat("/tmp/localhoster/hoster.sh get '", newurl, 0, 0); |
---|
78 | cmd = ostrcat(cmd, "'", 1, 0); |
---|
79 | debug(99, "cmd: %s", cmd); |
---|
80 | tmpstr = command(cmd); |
---|
81 | free(cmd), cmd = NULL; |
---|
82 | // new end |
---|
83 | free(newurl), newurl = NULL; |
---|
84 | |
---|
85 | if(!ostrncmp("errormsg=", tmpstr, 9)) |
---|
86 | { |
---|
87 | tmpstr1 = ostrcat(_("Found error Msg:"), "\n\n", 0, 0); |
---|
88 | tmpstr1 = ostrcat(tmpstr1, tmpstr, 1, 0); |
---|
89 | tmpstr1 = string_replace("errormsg=", "", tmpstr1, 1); |
---|
90 | |
---|
91 | debug(99, "Found error Msg: %s", tmpstr); |
---|
92 | textbox(_("Message"), tmpstr1, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1100, 300, 0, 2); |
---|
93 | free(tmpstr); tmpstr = NULL; |
---|
94 | free(tmpstr1); tmpstr1 = NULL; |
---|
95 | } |
---|
96 | |
---|
97 | tmpstr = string_resub("<div id=\"beep\" class=\"beep\"></div>", "</table>", tmpstr, 0); |
---|
98 | |
---|
99 | titheklog(debuglevel, "/tmp/kinox1_tmpstr", NULL, NULL, NULL, tmpstr); |
---|
100 | |
---|
101 | int count = 0; |
---|
102 | int incount = 0; |
---|
103 | int i = 0; |
---|
104 | struct splitstr* ret1 = NULL; |
---|
105 | ret1 = strsplit(tmpstr, "\n", &count); |
---|
106 | |
---|
107 | if(ret1 != NULL) |
---|
108 | { |
---|
109 | int max = count; |
---|
110 | for(i = 0; i < max; i++) |
---|
111 | { |
---|
112 | if(oregex(".*src=\"/gr/sys/lng/(.*)\" alt=\"language\"></td>.*", ret1[i].part) != NULL) |
---|
113 | { |
---|
114 | free(langck), langck = NULL; |
---|
115 | langck = oregex(".*src=\"/gr/sys/lng/(.*)\" alt=\"language\"></td>.*", ret1[i].part); |
---|
116 | } |
---|
117 | |
---|
118 | if(oregex(".*<td class=\"Title\"><a href=\"(.*)\" onclick=.*", ret1[i].part) != NULL) |
---|
119 | { |
---|
120 | int rcret = waitrc(NULL, 10, 0); |
---|
121 | if(rcret == getrcconfigint("rcexit", NULL)) break; |
---|
122 | free(path), path = NULL; |
---|
123 | path = oregex(".*<td class=\"Title\"><a href=\"(.*)\" onclick=.*", ret1[i].part); |
---|
124 | |
---|
125 | if(ostrstr(langck, "1.png") != NULL) |
---|
126 | lang = ostrcat(lang, " (de)", 1, 0); |
---|
127 | else if(ostrstr(langck, "2.png") != NULL) |
---|
128 | lang = ostrcat(lang, " (en)", 1, 0); |
---|
129 | else |
---|
130 | lang = ostrcat(lang, " (\?\?)", 1, 0); |
---|
131 | |
---|
132 | // tmpstr1 = gethttp("kinox.to", path, 80, NULL, NULL, 10000, NULL, 0); |
---|
133 | newurl = ostrcat(getconfig("tithek_kinox_url", NULL), "/", 0, 0); |
---|
134 | newurl = ostrcat(newurl, path, 1, 0); |
---|
135 | // tmpstr1 = gethttps(newurl, NULL, NULL, NULL, NULL, NULL, 1); |
---|
136 | // new start |
---|
137 | cmd = ostrcat("/tmp/localhoster/hoster.sh get '", newurl, 0, 0); |
---|
138 | cmd = ostrcat(cmd, "'", 1, 0); |
---|
139 | debug(99, "cmd: %s", cmd); |
---|
140 | tmpstr1 = command(cmd); |
---|
141 | free(cmd), cmd = NULL; |
---|
142 | // new end |
---|
143 | |
---|
144 | free(newurl), newurl = NULL; |
---|
145 | |
---|
146 | from = ostrcat("<div class=\"Grahpics\"><a href=\"", path, 0, 0); |
---|
147 | from = ostrcat(from, "\"><img src=\"", 1, 0); |
---|
148 | |
---|
149 | pic = string_resub(from, "\" alt=\"", tmpstr1, 0); |
---|
150 | |
---|
151 | if(pic == NULL) |
---|
152 | pic = ostrcat("dummy", NULL, 0, 0); |
---|
153 | |
---|
154 | title = ostrcat(path, NULL, 0, 0); |
---|
155 | title = string_replace_all("/Stream/", "", title, 1); |
---|
156 | title = string_replace_all(".html", "", title, 1); |
---|
157 | title = stringreplacechar(title, '_', ' '); |
---|
158 | title = ostrcat(title , lang, 1, 0); |
---|
159 | |
---|
160 | url = ostrcat(getconfig("tithek_kinox_url", NULL), "/", 0, 0); |
---|
161 | url = ostrcat(url, path, 1, 0); |
---|
162 | |
---|
163 | debug(99, "---------------------------"); |
---|
164 | debug(99, "langck: %s", langck); |
---|
165 | debug(99, "pic: %s", pic); |
---|
166 | debug(99, "title: %s", title); |
---|
167 | debug(99, "url: %s", url); |
---|
168 | debug(99, "---------------------------"); |
---|
169 | |
---|
170 | if(url != NULL) |
---|
171 | { |
---|
172 | incount += 1; |
---|
173 | line = ostrcat(line, title, 1, 0); |
---|
174 | line = ostrcat(line, "#", 1, 0); |
---|
175 | line = ostrcat(line, url, 1, 0); |
---|
176 | line = ostrcat(line, "#", 1, 0); |
---|
177 | line = ostrcat(line, getconfig("tithek_kinox_url", NULL), 1, 0); |
---|
178 | line = ostrcat(line, "/", 1, 0); |
---|
179 | line = ostrcat(line, pic, 1, 0); |
---|
180 | line = ostrcat(line, "#kinox_search_", 1, 0); |
---|
181 | /* |
---|
182 | line = ostrcat(line, "#/tmp/localhoster/hoster.sh get '", 1, 0); |
---|
183 | line = ostrcat(line, getconfig("tithek_kinox_url", NULL), 1, 0); |
---|
184 | line = ostrcat(line, "/", 1, 0); |
---|
185 | line = ostrcat(line, pic, 1, 0); |
---|
186 | line = ostrcat(line, "'#kinox_search_", 1, 0); |
---|
187 | */ |
---|
188 | |
---|
189 | line = ostrcat(line, oitoa(incount + time(NULL)), 1, 1); |
---|
190 | line = ostrcat(line, ".jpg#KinoX - Search#22\n", 1, 0); |
---|
191 | } |
---|
192 | free(url), url = NULL; |
---|
193 | free(path), path = NULL; |
---|
194 | free(title), title = NULL; |
---|
195 | free(pic), pic = NULL; |
---|
196 | free(from), from = NULL; |
---|
197 | free(tmpstr1), tmpstr1 = NULL; |
---|
198 | free(lang), lang = NULL; |
---|
199 | free(langck), langck = NULL; |
---|
200 | } |
---|
201 | } |
---|
202 | free(ret1), ret1 = NULL; |
---|
203 | if(line != NULL) |
---|
204 | { |
---|
205 | line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1); |
---|
206 | menu = ostrcat("/tmp/tithek/kinox.search.", oitoa(time(NULL)), 0, 1); |
---|
207 | menu = ostrcat(menu, ".list", 1, 0); |
---|
208 | |
---|
209 | writesys(menu, line, 0); |
---|
210 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
211 | createtithek(tnode, tnode->title, menu, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag); |
---|
212 | ret = 0; |
---|
213 | } |
---|
214 | |
---|
215 | } |
---|
216 | free(tmpstr), tmpstr = NULL; |
---|
217 | free(ip), ip = NULL; |
---|
218 | } |
---|
219 | free(search), search = NULL; |
---|
220 | return ret; |
---|
221 | } |
---|
222 | |
---|
223 | int kinox_search_local(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title, char* searchstr, int flag) |
---|
224 | { |
---|
225 | char* tmpstr = NULL, *tmpstr1 = NULL, *line = NULL, *menu = NULL, *search = NULL; |
---|
226 | int ret = 1, count = 0, i = 0; |
---|
227 | |
---|
228 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
229 | return ret; |
---|
230 | |
---|
231 | if(searchstr == NULL) |
---|
232 | search = textinputhist(_("Search"), " ", "searchhist"); |
---|
233 | else |
---|
234 | search = textinputhist(_("Search"), searchstr, "searchhist"); |
---|
235 | |
---|
236 | if(search != NULL) |
---|
237 | { |
---|
238 | drawscreen(load, 0, 0); |
---|
239 | |
---|
240 | strstrip(search); |
---|
241 | string_tolower(search); |
---|
242 | |
---|
243 | tmpstr = gethttp("atemio.dyndns.tv", "/mediathek/kinox/streams/kinox.all-sorted.list", 80, NULL, HTTPAUTH, 5000, NULL, 0); |
---|
244 | |
---|
245 | struct splitstr* ret1 = NULL; |
---|
246 | ret1 = strsplit(tmpstr, "\n", &count); |
---|
247 | |
---|
248 | if(ret1 != NULL) |
---|
249 | { |
---|
250 | int max = count; |
---|
251 | for(i = 0; i < max; i++) |
---|
252 | { |
---|
253 | |
---|
254 | tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0); |
---|
255 | tmpstr1 = stringreplacecharonce(tmpstr1, '#', '\0'); |
---|
256 | string_tolower(tmpstr1); |
---|
257 | |
---|
258 | if(ostrstr(tmpstr1, search) != NULL) |
---|
259 | { |
---|
260 | printf("found: %s\n", ret1[i].part); |
---|
261 | int rcret = waitrc(NULL, 10, 0); |
---|
262 | if(rcret == getrcconfigint("rcexit", NULL)) break; |
---|
263 | |
---|
264 | line = ostrcat(line, ret1[i].part, 1, 0); |
---|
265 | line = ostrcat(line, "\n", 0, 0); |
---|
266 | } |
---|
267 | free(tmpstr1), tmpstr1 = NULL; |
---|
268 | } |
---|
269 | free(ret1), ret1 = NULL; |
---|
270 | |
---|
271 | if(line != NULL) |
---|
272 | { |
---|
273 | line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1); |
---|
274 | menu = ostrcat("/tmp/tithek/kinox.search.", oitoa(time(NULL)), 0, 1); |
---|
275 | menu = ostrcat(menu, ".list", 1, 0); |
---|
276 | |
---|
277 | writesys(menu, line, 0); |
---|
278 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
279 | createtithek(tnode, tnode->title, menu, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag); |
---|
280 | ret = 0; |
---|
281 | } |
---|
282 | } |
---|
283 | free(tmpstr), tmpstr = NULL; |
---|
284 | } |
---|
285 | free(search), search = NULL; |
---|
286 | return ret; |
---|
287 | } |
---|
288 | |
---|
289 | int kinox_hoster(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title) |
---|
290 | { |
---|
291 | debug(99, "link: %s", link); |
---|
292 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
293 | int ret = 1, series = 0; |
---|
294 | char* ip = NULL, *pos = NULL, *path = NULL, *tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL, *tmpstr3 = NULL, *pichname = NULL; |
---|
295 | char* tmpstr4 = NULL, *tmpstr5 = NULL, *line = NULL, *url = NULL, *url2 = NULL, *url3 = NULL, *url4 = NULL, *pathnew = NULL, *extra = NULL; |
---|
296 | char* newurl = NULL; |
---|
297 | char* cmd = NULL; |
---|
298 | |
---|
299 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
300 | return ret; |
---|
301 | |
---|
302 | ip = string_replace("http://", "", (char*)link, 0); |
---|
303 | |
---|
304 | if(ip != NULL) |
---|
305 | pos = strchr(ip, '/'); |
---|
306 | if(pos != NULL) |
---|
307 | { |
---|
308 | pos[0] = '\0'; |
---|
309 | path = pos + 1; |
---|
310 | } |
---|
311 | |
---|
312 | int cloudflare = 1; |
---|
313 | int localhoster = 1; |
---|
314 | newurl = ostrcat(getconfig("tithek_kinox_url", NULL), "/", 0, 0); |
---|
315 | newurl = ostrcat(newurl, path, 1, 0); |
---|
316 | |
---|
317 | if(cloudflare == 0) |
---|
318 | { |
---|
319 | // tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0); |
---|
320 | // tmpstr = gethttps(link, NULL, NULL, NULL, NULL, NULL, 1); |
---|
321 | tmpstr = gethttps(newurl, NULL, NULL, NULL, NULL, NULL, 1); |
---|
322 | } |
---|
323 | else |
---|
324 | { |
---|
325 | // new start |
---|
326 | cmd = ostrcat("/tmp/localhoster/hoster.sh get '", newurl, 0, 0); |
---|
327 | cmd = ostrcat(cmd, "'", 1, 0); |
---|
328 | debug(99, "cmd: %s", cmd); |
---|
329 | tmpstr = command(cmd); |
---|
330 | free(cmd), cmd = NULL; |
---|
331 | // new end |
---|
332 | } |
---|
333 | titheklog(debuglevel, "/tmp/kinox2_tmpstr", NULL, NULL, NULL, tmpstr); |
---|
334 | |
---|
335 | if(!ostrncmp("errormsg=", tmpstr, 9)) |
---|
336 | { |
---|
337 | tmpstr1 = ostrcat(_("Found error Msg:"), "\n\n", 0, 0); |
---|
338 | tmpstr1 = ostrcat(tmpstr1, tmpstr, 1, 0); |
---|
339 | tmpstr1 = string_replace("errormsg=", "", tmpstr1, 1); |
---|
340 | |
---|
341 | debug(99, "Found error Msg: %s", tmpstr); |
---|
342 | textbox(_("Message"), tmpstr1, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1100, 300, 0, 2); |
---|
343 | free(tmpstr); tmpstr = NULL; |
---|
344 | free(tmpstr1); tmpstr1 = NULL; |
---|
345 | } |
---|
346 | |
---|
347 | if(tmpstr != NULL) |
---|
348 | { |
---|
349 | drawscreen(load, 0, 0); |
---|
350 | if(ostrstr(tmpstr, "SeriesID") != NULL) |
---|
351 | { |
---|
352 | char* pos1 = NULL; |
---|
353 | char* from = NULL; |
---|
354 | char* folgen = NULL; |
---|
355 | int i; |
---|
356 | |
---|
357 | series = 1; |
---|
358 | |
---|
359 | for(i = 1; i < 30; i++) |
---|
360 | { |
---|
361 | from = ostrcat(from, "<option value=\"", 1, 0); |
---|
362 | from = ostrcat(from, oitoa(i), 1, 0); |
---|
363 | from = ostrcat(from, "\" rel=", 1, 0); |
---|
364 | |
---|
365 | pos1 = ostrstr(tmpstr, from); |
---|
366 | folgen = getxmlentry(ostrstr(tmpstr, from), "rel="); |
---|
367 | printf("Season %d folgen: %s\n",i , folgen); |
---|
368 | |
---|
369 | if(folgen != NULL) |
---|
370 | { |
---|
371 | int count = 0; |
---|
372 | int incount = 0; |
---|
373 | int j; |
---|
374 | struct splitstr* ret1 = NULL; |
---|
375 | ret1 = strsplit(folgen, ",", &count); |
---|
376 | |
---|
377 | if(ret1 != NULL && count > 0) |
---|
378 | { |
---|
379 | int max = count + 1; |
---|
380 | for(j = 1; j < max; j++) |
---|
381 | { |
---|
382 | incount += 1; |
---|
383 | line = ostrcat(line, _("Season"), 1, 0); |
---|
384 | line = ostrcat(line, " ", 1, 0); |
---|
385 | line = ostrcat(line, oitoa(i), 1, 0); |
---|
386 | line = ostrcat(line, " ", 1, 0); |
---|
387 | line = ostrcat(line, _("Episode"), 1, 0); |
---|
388 | line = ostrcat(line, " ", 1, 0); |
---|
389 | line = ostrcat(line, oitoa(j), 1, 0); |
---|
390 | line = ostrcat(line, "#", 1, 0); |
---|
391 | line = ostrcat(line, link, 1, 0); |
---|
392 | line = ostrcat(line, ";", 1, 0); |
---|
393 | line = ostrcat(line, oitoa(i), 1, 0); |
---|
394 | line = ostrcat(line, ";", 1, 0); |
---|
395 | line = ostrcat(line, oitoa(j), 1, 0); |
---|
396 | line = ostrcat(line, "#", 1, 0); |
---|
397 | line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/s", 1, 0); |
---|
398 | line = ostrcat(line, oitoa(i), 1, 0); |
---|
399 | line = ostrcat(line, "e", 1, 0); |
---|
400 | line = ostrcat(line, oitoa(j), 1, 0); |
---|
401 | line = ostrcat(line, ".jpg", 1, 0); |
---|
402 | line = ostrcat(line, "#kinox_search_", 1, 0); |
---|
403 | line = ostrcat(line, oitoa(i), 1, 0); |
---|
404 | line = ostrcat(line, "e", 1, 0); |
---|
405 | line = ostrcat(line, oitoa(j), 1, 0); |
---|
406 | line = ostrcat(line, ".jpg#KinoX - ", 1, 0); |
---|
407 | line = ostrcat(line, title, 1, 0); |
---|
408 | line = ostrcat(line, "#23\n", 1, 0); |
---|
409 | } |
---|
410 | } |
---|
411 | free(ret1), ret1 = NULL; |
---|
412 | } |
---|
413 | free(from), from = NULL; |
---|
414 | free(folgen), folgen = NULL; |
---|
415 | } |
---|
416 | } |
---|
417 | else |
---|
418 | { |
---|
419 | tmpstr = string_resub("<ul id=\"HosterList\" class=\"Sortable\">", "</ul>", tmpstr, 0); |
---|
420 | titheklog(debuglevel, "/tmp/kinox3_tmpstr", NULL, NULL, NULL, tmpstr); |
---|
421 | |
---|
422 | int type = 14; |
---|
423 | int count = 0; |
---|
424 | int incount = 0; |
---|
425 | int i; |
---|
426 | struct splitstr* ret1 = NULL; |
---|
427 | ret1 = strsplit(tmpstr, "\n", &count); |
---|
428 | |
---|
429 | char* hname = NULL; |
---|
430 | char* hnr = NULL; |
---|
431 | char* hlink = NULL; |
---|
432 | |
---|
433 | if(ret1 != NULL && count > 0) |
---|
434 | { |
---|
435 | int max = count; |
---|
436 | for(i = 0; i < max; i++) |
---|
437 | { |
---|
438 | char *mirrormaxtmp = NULL; |
---|
439 | char *pathnewtmp = NULL; |
---|
440 | int mirrormax = 1; |
---|
441 | int j = 0; |
---|
442 | |
---|
443 | mirrormaxtmp = oregex("<b>Mirror</b>: .*/(.*)<br/>.*", ret1[i].part); |
---|
444 | |
---|
445 | if(mirrormaxtmp != NULL) |
---|
446 | mirrormax = atoi(mirrormaxtmp); |
---|
447 | |
---|
448 | debug(99, "### START ####################################################"); |
---|
449 | |
---|
450 | for(j = 1; j < mirrormax + 1; j++) |
---|
451 | { |
---|
452 | debug(99, "(%d/%d) (%d/%d) ret1[i].part: %s",i ,max ,j ,mirrormax, ret1[i].part); |
---|
453 | |
---|
454 | hnr = string_resub("<li id=\"Hoster_", "\"", ret1[i].part, 0); |
---|
455 | |
---|
456 | hlink = string_resub("rel=\"", "amp;Mirror", ret1[i].part, 0); |
---|
457 | |
---|
458 | if (hlink == NULL) |
---|
459 | { |
---|
460 | hlink = string_resub("rel=\"", "\">", ret1[i].part, 0); |
---|
461 | hlink = string_replace_all("amp;Hoster", "Hoster", hlink, 1); |
---|
462 | hname = string_resub("<div class=\"Named\">", "</div>", ret1[i].part, 0); |
---|
463 | pathnewtmp = ostrcat(getconfig("tithek_kinox_url", NULL), "/aGET/Mirror/", 0, 0); |
---|
464 | pathnewtmp = ostrcat(pathnewtmp, hlink, 1, 0); |
---|
465 | pathnew = ostrcat(pathnewtmp, NULL, 0, 0); |
---|
466 | } |
---|
467 | else |
---|
468 | { |
---|
469 | hlink = string_replace_all("amp;Hoster", "Hoster", hlink, 1); |
---|
470 | hlink = ostrcat(hlink, "Mirror=", 0, 0); |
---|
471 | hname = string_resub("<div class=\"Named\">", "</div>", ret1[i].part, 0); |
---|
472 | pathnewtmp = ostrcat(getconfig("tithek_kinox_url", NULL), "/aGET/Mirror/", 0, 0); |
---|
473 | pathnewtmp = ostrcat(pathnewtmp, hlink, 1, 0); |
---|
474 | pathnew = ostrcat(pathnewtmp, oitoa(j), 0, 1); |
---|
475 | } |
---|
476 | debug(99, "(%d/%d) (%d/%d)hnr: %s hlink: %s hname: %s pathnewtmp: %s",i ,max ,j ,mirrormax ,hnr ,hlink ,hname ,pathnewtmp); |
---|
477 | free(pathnewtmp), pathnewtmp= NULL; |
---|
478 | |
---|
479 | pichname = ostrcat(hname, NULL, 0, 0); |
---|
480 | string_tolower(pichname); |
---|
481 | pichname = stringreplacecharonce(pichname, '.', '\0'); |
---|
482 | |
---|
483 | extra = string_resub("<b>Vom</b>: ", "</div>", ret1[i].part, 0); |
---|
484 | |
---|
485 | titheklog(debuglevel, "/tmp/kinox4_pathnew1", hname, NULL, NULL, pathnew); |
---|
486 | |
---|
487 | |
---|
488 | if(cloudflare == 0) |
---|
489 | { |
---|
490 | // tmpstr1 = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0); |
---|
491 | tmpstr1 = gethttps(pathnew, NULL, NULL, NULL, NULL, NULL, 1); |
---|
492 | } |
---|
493 | else if(localhoster == 1) |
---|
494 | { |
---|
495 | cmd = ostrcat("/tmp/localhoster/hoster.sh hoster '", pathnew, 0, 0); |
---|
496 | cmd = ostrcat(cmd, "'", 1, 0); |
---|
497 | debug(99, "cmd: %s", cmd); |
---|
498 | url = ostrcat(cmd, NULL, 0, 0); |
---|
499 | } |
---|
500 | else |
---|
501 | { |
---|
502 | // new start |
---|
503 | cmd = ostrcat("/tmp/localhoster/hoster.sh get '", pathnew, 0, 0); |
---|
504 | cmd = ostrcat(cmd, "'", 1, 0); |
---|
505 | debug(99, "cmd: %s", cmd); |
---|
506 | tmpstr1 = command(cmd); |
---|
507 | free(cmd), cmd = NULL; |
---|
508 | // new end |
---|
509 | } |
---|
510 | if(ostrstr(tmpstr1, "503 Service Temporarily Unavailable") != NULL) |
---|
511 | { |
---|
512 | sleep(1); |
---|
513 | if(cloudflare == 0) |
---|
514 | { |
---|
515 | // tmpstr1 = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0); |
---|
516 | tmpstr1 = gethttps(pathnew, NULL, NULL, NULL, NULL, NULL, 1); |
---|
517 | } |
---|
518 | else |
---|
519 | { |
---|
520 | // new start |
---|
521 | cmd = ostrcat("/tmp/localhoster/hoster.sh get '", pathnew, 0, 0); |
---|
522 | cmd = ostrcat(cmd, "'", 1, 0); |
---|
523 | debug(99, "cmd: %s", cmd); |
---|
524 | tmpstr1 = command(cmd); |
---|
525 | free(cmd), cmd = NULL; |
---|
526 | // new end |
---|
527 | } |
---|
528 | } |
---|
529 | if(ostrstr(tmpstr1, "503 Service Temporarily Unavailable") != NULL) |
---|
530 | { |
---|
531 | sleep(1); |
---|
532 | if(cloudflare == 0) |
---|
533 | { |
---|
534 | // tmpstr1 = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0); |
---|
535 | tmpstr1 = gethttps(pathnew, NULL, NULL, NULL, NULL, NULL, 1); |
---|
536 | } |
---|
537 | else |
---|
538 | { |
---|
539 | // new start |
---|
540 | cmd = ostrcat("/tmp/localhoster/hoster.sh get '", pathnew, 0, 0); |
---|
541 | cmd = ostrcat(cmd, "'", 1, 0); |
---|
542 | debug(99, "cmd: %s", cmd); |
---|
543 | tmpstr1 = command(cmd); |
---|
544 | free(cmd), cmd = NULL; |
---|
545 | // new end |
---|
546 | } |
---|
547 | } |
---|
548 | if(ostrstr(tmpstr1, "503 Service Temporarily Unavailable") != NULL) |
---|
549 | { |
---|
550 | sleep(1); |
---|
551 | if(cloudflare == 0) |
---|
552 | { |
---|
553 | // tmpstr1 = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0); |
---|
554 | tmpstr1 = gethttps(pathnew, NULL, NULL, NULL, NULL, NULL, 1); |
---|
555 | } |
---|
556 | else |
---|
557 | { |
---|
558 | // new start |
---|
559 | cmd = ostrcat("/tmp/localhoster/hoster.sh get '", pathnew, 0, 0); |
---|
560 | cmd = ostrcat(cmd, "'", 1, 0); |
---|
561 | debug(99, "cmd: %s", cmd); |
---|
562 | tmpstr1 = command(cmd); |
---|
563 | free(cmd), cmd = NULL; |
---|
564 | // new end |
---|
565 | } |
---|
566 | } |
---|
567 | if(ostrstr(tmpstr1, "503 Service Temporarily Unavailable") != NULL) |
---|
568 | { |
---|
569 | sleep(1); |
---|
570 | if(cloudflare == 0) |
---|
571 | { |
---|
572 | // tmpstr1 = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0); |
---|
573 | tmpstr1 = gethttps(pathnew, NULL, NULL, NULL, NULL, NULL, 1); |
---|
574 | } |
---|
575 | else |
---|
576 | { |
---|
577 | // new start |
---|
578 | cmd = ostrcat("/tmp/localhoster/hoster.sh get '", pathnew, 0, 0); |
---|
579 | cmd = ostrcat(cmd, "'", 1, 0); |
---|
580 | debug(99, "cmd: %s", cmd); |
---|
581 | tmpstr1 = command(cmd); |
---|
582 | free(cmd), cmd = NULL; |
---|
583 | // new end |
---|
584 | } |
---|
585 | } |
---|
586 | free(pathnew), pathnew = NULL; |
---|
587 | |
---|
588 | titheklog(debuglevel, "/tmp/kinox5_tmpstr1", hname, NULL, NULL, tmpstr1); |
---|
589 | |
---|
590 | |
---|
591 | tmpstr1 = string_replace_all("\\", "", tmpstr1, 1); |
---|
592 | |
---|
593 | if(localhoster == 0) |
---|
594 | { |
---|
595 | if(ostrstr(tmpstr1, "iframe src") != NULL) |
---|
596 | url = string_resub("<iframe src=\"", "\"", tmpstr1, 0); |
---|
597 | else |
---|
598 | url = string_resub("<a href=\"", "\"", tmpstr1, 0); |
---|
599 | } |
---|
600 | |
---|
601 | //url = ostrcat(tmpstr1, NULL, 0, 0); |
---|
602 | //////////////// |
---|
603 | /* |
---|
604 | free(pathnew), pathnew = NULL; |
---|
605 | pathnew = ostrcat("/aGET/Mirror/", hlink, 0, 0); |
---|
606 | pathnew = ostrcat(pathnew, "&Part=2", 1, 0); |
---|
607 | |
---|
608 | titheklog(debuglevel, "/tmp/kinox6_pathnew2", hname, NULL, NULL, pathnew); |
---|
609 | |
---|
610 | tmpstr3 = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0); |
---|
611 | if(ostrstr(tmpstr3, "503 Service Temporarily Unavailable") != NULL) |
---|
612 | { |
---|
613 | sleep(1); |
---|
614 | tmpstr3 = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0); |
---|
615 | } |
---|
616 | free(pathnew), pathnew = NULL; |
---|
617 | |
---|
618 | titheklog(debuglevel, "/tmp/kinox7_tmpstr3", hname, NULL, NULL, tmpstr3); |
---|
619 | |
---|
620 | tmpstr3 = string_replace_all("\\", "", tmpstr3, 1); |
---|
621 | if(ostrstr(tmpstr3, "iframe src") != NULL) |
---|
622 | url2 = string_resub("<iframe src=\"", "\"", tmpstr3, 0); |
---|
623 | else |
---|
624 | url2 = string_resub("<a href=\"", "\"", tmpstr3, 0); |
---|
625 | // url2 = ostrcat(tmpstr3, NULL, 0, 0); |
---|
626 | //////////////// |
---|
627 | free(pathnew), pathnew = NULL; |
---|
628 | pathnew = ostrcat("/aGET/Mirror/", hlink, 0, 0); |
---|
629 | pathnew = ostrcat(pathnew, "&Part=3", 1, 0); |
---|
630 | |
---|
631 | titheklog(debuglevel, "/tmp/kinox6_pathnew3", hname, NULL, NULL, pathnew); |
---|
632 | |
---|
633 | tmpstr4 = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0); |
---|
634 | if(ostrstr(tmpstr4, "503 Service Temporarily Unavailable") != NULL) |
---|
635 | { |
---|
636 | sleep(1); |
---|
637 | tmpstr4 = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0); |
---|
638 | } |
---|
639 | free(pathnew), pathnew = NULL; |
---|
640 | |
---|
641 | titheklog(debuglevel, "/tmp/kinox7_tmpstr4", hname, NULL, NULL, tmpstr4); |
---|
642 | |
---|
643 | tmpstr4 = string_replace_all("\\", "", tmpstr4, 1); |
---|
644 | if(ostrstr(tmpstr4, "iframe src") != NULL) |
---|
645 | url3 = string_resub("<iframe src=\"", "\"", tmpstr4, 0); |
---|
646 | else |
---|
647 | url3 = string_resub("<a href=\"", "\"", tmpstr4, 0); |
---|
648 | // url3 = ostrcat(tmpstr4, NULL, 0, 0); |
---|
649 | //////////////// |
---|
650 | free(pathnew), pathnew = NULL; |
---|
651 | pathnew = ostrcat("/aGET/Mirror/", hlink, 0, 0); |
---|
652 | pathnew = ostrcat(pathnew, "&Part=4", 1, 0); |
---|
653 | |
---|
654 | titheklog(debuglevel, "/tmp/kinox6_pathnew4", hname, NULL, NULL, pathnew); |
---|
655 | |
---|
656 | tmpstr5 = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0); |
---|
657 | if(ostrstr(tmpstr5, "503 Service Temporarily Unavailable") != NULL) |
---|
658 | { |
---|
659 | sleep(1); |
---|
660 | tmpstr5 = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0); |
---|
661 | } |
---|
662 | free(pathnew), pathnew = NULL; |
---|
663 | |
---|
664 | titheklog(debuglevel, "/tmp/kinox7_tmpstr5", hname, NULL, NULL, tmpstr5); |
---|
665 | |
---|
666 | tmpstr5 = string_replace_all("\\", "", tmpstr5, 1); |
---|
667 | if(ostrstr(tmpstr5, "iframe src") != NULL) |
---|
668 | url4 = string_resub("<iframe src=\"", "\"", tmpstr5, 0); |
---|
669 | else |
---|
670 | url4 = string_resub("<a href=\"", "\"", tmpstr5, 0); |
---|
671 | // url4 = ostrcat(tmpstr5, NULL, 0, 0); |
---|
672 | //////////////// |
---|
673 | */ |
---|
674 | type = 14; |
---|
675 | if(localhoster == 1) |
---|
676 | type = 111; |
---|
677 | |
---|
678 | debug(99, "-------------------------------"); |
---|
679 | // if(ostrcmp(url, url2) != 0) |
---|
680 | // { |
---|
681 | // debug(99, "(%d/%d) (%d/%d) %s (Part1) url: %s extra: %s",i ,max ,j ,mirrormax ,hname ,url ,extra); |
---|
682 | // } |
---|
683 | // else |
---|
684 | // { |
---|
685 | debug(99, "(%d/%d) (%d/%d) %s url: %s extra: %s",i ,max ,j ,mirrormax ,hname ,url ,extra); |
---|
686 | // } |
---|
687 | debug(99, "-------------------------------"); |
---|
688 | |
---|
689 | incount += 1; |
---|
690 | line = ostrcat(line, hname, 1, 0); |
---|
691 | |
---|
692 | if(url == NULL) |
---|
693 | line = ostrcat(line, " (Error)", 1, 0); |
---|
694 | |
---|
695 | if(url2 != NULL && ostrcmp(url, url2) != 0) |
---|
696 | line = ostrcat(line, " (Part1)", 1, 0); |
---|
697 | if(extra != NULL) |
---|
698 | { |
---|
699 | line = ostrcat(line, " (", 1, 0); |
---|
700 | line = ostrcat(line, extra, 1, 0); |
---|
701 | line = ostrcat(line, ")", 1, 0); |
---|
702 | } |
---|
703 | |
---|
704 | line = ostrcat(line, " (Mirror ", 1, 0); |
---|
705 | line = ostrcat(line, oitoa(j), 1, 1); |
---|
706 | line = ostrcat(line, "/", 1, 0); |
---|
707 | line = ostrcat(line, oitoa(mirrormax), 1, 1); |
---|
708 | line = ostrcat(line, ")", 1, 0); |
---|
709 | |
---|
710 | |
---|
711 | line = ostrcat(line, "#", 1, 0); |
---|
712 | if(!ostrncmp("//", url, 2)) |
---|
713 | line = ostrcat(line, "http:", 1, 0); |
---|
714 | line = ostrcat(line, url, 1, 0); |
---|
715 | line = ostrcat(line, "#", 1, 0); |
---|
716 | line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/", 1, 0); |
---|
717 | line = ostrcat(line, pichname, 1, 0); |
---|
718 | line = ostrcat(line, ".jpg#kinox_", 1, 0); |
---|
719 | line = ostrcat(line, pichname, 1, 0); |
---|
720 | line = ostrcat(line, ".jpg#KinoX - ", 1, 0); |
---|
721 | line = ostrcat(line, title, 1, 0); |
---|
722 | line = ostrcat(line, "#", 1, 0); |
---|
723 | line = ostrcat(line, oitoa(type), 1, 0); |
---|
724 | line = ostrcat(line, "\n", 1, 0); |
---|
725 | /* |
---|
726 | if((url != NULL && url2 != NULL) && ostrcmp(url, url2) != 0) |
---|
727 | { |
---|
728 | free(tmpstr2), tmpstr2 = NULL; |
---|
729 | free(hname), hname = NULL; |
---|
730 | hname = string_resub("<div class=\"Named\">", "</div>", ret1[i].part, 0); |
---|
731 | pichname = ostrcat(hname, NULL, 0, 0); |
---|
732 | string_tolower(pichname); |
---|
733 | pichname = stringreplacecharonce(pichname, '\n', '\0'); |
---|
734 | |
---|
735 | type = 14; |
---|
736 | |
---|
737 | debug(99, "-------------------------------"); |
---|
738 | debug(99, "(%d/%d) %s (Part2) url: %s extra: %s",i ,max, hname, url2, extra); |
---|
739 | |
---|
740 | incount += 1; |
---|
741 | line = ostrcat(line, hname, 1, 0); |
---|
742 | line = ostrcat(line, " (Part2)", 1, 0); |
---|
743 | if(extra != NULL) |
---|
744 | { |
---|
745 | line = ostrcat(line, " (", 1, 0); |
---|
746 | line = ostrcat(line, extra, 1, 0); |
---|
747 | line = ostrcat(line, ")", 1, 0); |
---|
748 | } |
---|
749 | line = ostrcat(line, "#", 1, 0); |
---|
750 | line = ostrcat(line, url2, 1, 0); |
---|
751 | line = ostrcat(line, "#", 1, 0); |
---|
752 | line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/", 1, 0); |
---|
753 | line = ostrcat(line, pichname, 1, 0); |
---|
754 | line = ostrcat(line, ".jpg#kinox_", 1, 0); |
---|
755 | line = ostrcat(line, pichname, 1, 0); |
---|
756 | line = ostrcat(line, ".jpg#KinoX - ", 1, 0); |
---|
757 | line = ostrcat(line, title, 1, 0); |
---|
758 | line = ostrcat(line, "#", 1, 0); |
---|
759 | line = ostrcat(line, oitoa(type), 1, 0); |
---|
760 | line = ostrcat(line, "\n", 1, 0); |
---|
761 | free(tmpstr2), tmpstr2 = NULL; |
---|
762 | } |
---|
763 | |
---|
764 | if((url != NULL && url3 != NULL) && ostrcmp(url, url3) != 0 && ostrcmp(url2, url3) != 0) |
---|
765 | { |
---|
766 | free(tmpstr2), tmpstr2 = NULL; |
---|
767 | free(hname), hname = NULL; |
---|
768 | hname = string_resub("<div class=\"Named\">", "</div>", ret1[i].part, 0); |
---|
769 | pichname = ostrcat(hname, NULL, 0, 0); |
---|
770 | string_tolower(pichname); |
---|
771 | pichname = stringreplacecharonce(pichname, '\n', '\0'); |
---|
772 | type = 14; |
---|
773 | |
---|
774 | debug(99, "-------------------------------"); |
---|
775 | debug(99, "(%d/%d) %s (Part3) url: %s extra: %s",i ,max , hname, url3, extra); |
---|
776 | |
---|
777 | incount += 1; |
---|
778 | line = ostrcat(line, hname, 1, 0); |
---|
779 | if(extra != NULL) |
---|
780 | line = ostrcat(line, " (Part3)", 1, 0); |
---|
781 | if(extra != NULL) |
---|
782 | { |
---|
783 | line = ostrcat(line, " (", 1, 0); |
---|
784 | line = ostrcat(line, extra, 1, 0); |
---|
785 | line = ostrcat(line, ")", 1, 0); |
---|
786 | } |
---|
787 | line = ostrcat(line, "#", 1, 0); |
---|
788 | line = ostrcat(line, url3, 1, 0); |
---|
789 | line = ostrcat(line, "#", 1, 0); |
---|
790 | line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/", 1, 0); |
---|
791 | line = ostrcat(line, pichname, 1, 0); |
---|
792 | line = ostrcat(line, ".jpg#kinox_", 1, 0); |
---|
793 | line = ostrcat(line, pichname, 1, 0); |
---|
794 | line = ostrcat(line, ".jpg#KinoX - ", 1, 0); |
---|
795 | line = ostrcat(line, title, 1, 0); |
---|
796 | line = ostrcat(line, "#", 1, 0); |
---|
797 | line = ostrcat(line, oitoa(type), 1, 0); |
---|
798 | line = ostrcat(line, "\n", 1, 0); |
---|
799 | free(tmpstr2), tmpstr2 = NULL; |
---|
800 | } |
---|
801 | |
---|
802 | if((url != NULL && url4 != NULL) && ostrcmp(url, url4) != 0 && ostrcmp(url2, url4) != 0 && ostrcmp(url3, url4) != 0) |
---|
803 | { |
---|
804 | free(tmpstr2), tmpstr2 = NULL; |
---|
805 | free(hname), hname = NULL; |
---|
806 | hname = string_resub("<div class=\"Named\">", "</div>", ret1[i].part, 0); |
---|
807 | pichname = ostrcat(hname, NULL, 0, 0); |
---|
808 | string_tolower(pichname); |
---|
809 | pichname = stringreplacecharonce(pichname, '\n', '\0'); |
---|
810 | type = 14; |
---|
811 | debug(99, "-------------------------------"); |
---|
812 | debug(99, "(%d/%d) %s (Part4) url: %s extra: %s",i ,max , hname, url4, extra); |
---|
813 | |
---|
814 | incount += 1; |
---|
815 | line = ostrcat(line, hname, 1, 0); |
---|
816 | line = ostrcat(line, " (Part4)", 1, 0); |
---|
817 | if(extra != NULL) |
---|
818 | { |
---|
819 | line = ostrcat(line, " (", 1, 0); |
---|
820 | line = ostrcat(line, extra, 1, 0); |
---|
821 | line = ostrcat(line, ")", 1, 0); |
---|
822 | } |
---|
823 | line = ostrcat(line, "#", 1, 0); |
---|
824 | line = ostrcat(line, url4, 1, 0); |
---|
825 | line = ostrcat(line, "#", 1, 0); |
---|
826 | line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/", 1, 0); |
---|
827 | line = ostrcat(line, pichname, 1, 0); |
---|
828 | line = ostrcat(line, ".jpg#kinox_", 1, 0); |
---|
829 | line = ostrcat(line, pichname, 1, 0); |
---|
830 | line = ostrcat(line, ".jpg#KinoX - ", 1, 0); |
---|
831 | line = ostrcat(line, title, 1, 0); |
---|
832 | line = ostrcat(line, "#", 1, 0); |
---|
833 | line = ostrcat(line, oitoa(type), 1, 0); |
---|
834 | line = ostrcat(line, "\n", 1, 0); |
---|
835 | free(tmpstr2), tmpstr2 = NULL; |
---|
836 | } |
---|
837 | */ |
---|
838 | free(tmpstr1), tmpstr1 = NULL; |
---|
839 | free(tmpstr2), tmpstr2 = NULL; |
---|
840 | free(tmpstr3), tmpstr3 = NULL; |
---|
841 | free(tmpstr4), tmpstr4 = NULL; |
---|
842 | free(tmpstr5), tmpstr5 = NULL; |
---|
843 | free(hname), hname = NULL; |
---|
844 | free(hnr), hnr = NULL; |
---|
845 | free(hlink), hlink = NULL; |
---|
846 | free(url), url = NULL; |
---|
847 | free(url2), url2 = NULL; |
---|
848 | free(url3), url3 = NULL; |
---|
849 | free(url4), url4 = NULL; |
---|
850 | free(pathnew), pathnew = NULL; |
---|
851 | free(pichname), pichname = NULL; |
---|
852 | free(extra), extra = NULL; |
---|
853 | } |
---|
854 | debug(99, "### END #####################################################"); |
---|
855 | } |
---|
856 | } |
---|
857 | free(ret1), ret1 = NULL; |
---|
858 | } |
---|
859 | } |
---|
860 | free(tmpstr), tmpstr = NULL; |
---|
861 | |
---|
862 | if(line != NULL) |
---|
863 | { |
---|
864 | line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1); |
---|
865 | if(series == 0) |
---|
866 | { |
---|
867 | tmpstr = ostrcat("/tmp/tithek/kinox.hoster.", oitoa(time(NULL)), 0, 1); |
---|
868 | tmpstr = ostrcat(tmpstr, ".list", 1, 0); |
---|
869 | } |
---|
870 | else |
---|
871 | { |
---|
872 | tmpstr = ostrcat("/tmp/tithek/kinox.hoster.ser.", oitoa(time(NULL)), 0, 1); |
---|
873 | tmpstr = ostrcat(tmpstr, ".list", 1, 0); |
---|
874 | } |
---|
875 | writesys(tmpstr, line, 0); |
---|
876 | |
---|
877 | titheklog(debuglevel, "/tmp/kinox8_line", NULL, NULL, NULL, line); |
---|
878 | |
---|
879 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
880 | createtithek(tnode, tnode->title, tmpstr, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag); |
---|
881 | ret = 0; |
---|
882 | } |
---|
883 | |
---|
884 | return ret; |
---|
885 | } |
---|
886 | |
---|
887 | int kinox_hoster_series(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title) |
---|
888 | { |
---|
889 | debug(99, "link: %s", link); |
---|
890 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
891 | int ret = 1; |
---|
892 | char* ip = NULL, *pathnew = NULL, *seriesid = NULL, *searchname = NULL, *url = NULL, *session = NULL, *episode = NULL, *pos = NULL, *path = NULL, *tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL, *line = NULL; |
---|
893 | char* pichname = NULL, *extra= NULL; |
---|
894 | char* newurl = NULL; |
---|
895 | char *cmd = NULL; |
---|
896 | |
---|
897 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
898 | return ret; |
---|
899 | |
---|
900 | int count0 = 0; |
---|
901 | struct splitstr* ret0 = NULL; |
---|
902 | ret0 = strsplit(link, ";", &count0); |
---|
903 | if(ret0 != NULL && count0 >= 3) |
---|
904 | { |
---|
905 | url = ostrcat(url, ret0[0].part, 1, 0); |
---|
906 | debug(99, "url: %s", url); |
---|
907 | |
---|
908 | session = ostrcat(session, ret0[1].part, 1, 0); |
---|
909 | debug(99, "Season: %s", session); |
---|
910 | |
---|
911 | episode = ostrcat(episode, ret0[2].part, 1, 0); |
---|
912 | debug(99, "episode: %s", episode); |
---|
913 | |
---|
914 | searchname = ostrcat(searchname, ret0[0].part, 1, 0); |
---|
915 | |
---|
916 | searchname = string_replace("kinox.to", "", searchname, 0); |
---|
917 | searchname = string_replace(getconfig("tithek_kinox_url", NULL), "", searchname, 0); |
---|
918 | searchname = string_replace("http:////Stream/", "", searchname, 0); |
---|
919 | searchname = string_replace("http:///Stream/", "", searchname, 0); |
---|
920 | searchname = string_replace("http://Stream/", "", searchname, 0); |
---|
921 | searchname = string_replace("https:////Stream/", "", searchname, 0); |
---|
922 | searchname = string_replace("https:///Stream/", "", searchname, 0); |
---|
923 | searchname = string_replace("https://Stream/", "", searchname, 0); |
---|
924 | searchname = string_replace("//Stream/", "", searchname, 0); |
---|
925 | searchname = string_replace("/Stream/", "", searchname, 0); |
---|
926 | searchname = string_replace(".html", "", searchname, 0); |
---|
927 | debug(99, "searchname: %s", searchname); |
---|
928 | free(searchname), searchname = NULL; |
---|
929 | |
---|
930 | searchname = oregex("://.*/Stream/(.*).html.*", ret0[0].part); |
---|
931 | debug(99, "new searchname: %s", searchname); |
---|
932 | } |
---|
933 | free(ret0), ret0 = NULL; |
---|
934 | |
---|
935 | ip = string_replace("http://", "", url, 0); |
---|
936 | |
---|
937 | if(ip != NULL) |
---|
938 | pos = strchr(ip, '/'); |
---|
939 | if(pos != NULL) |
---|
940 | { |
---|
941 | pos[0] = '\0'; |
---|
942 | path = pos + 1; |
---|
943 | } |
---|
944 | |
---|
945 | pathnew = oregex("://.*/(.*).*", link); |
---|
946 | printf("new pathnew: %s\n",pathnew); |
---|
947 | |
---|
948 | int cloudflare = 1; |
---|
949 | int localhoster = 1; |
---|
950 | newurl = ostrcat(getconfig("tithek_kinox_url", NULL), "/", 0, 0); |
---|
951 | newurl = ostrcat(newurl, pathnew, 1, 0); |
---|
952 | |
---|
953 | if(cloudflare == 0) |
---|
954 | { |
---|
955 | // tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0); |
---|
956 | // tmpstr = gethttps(link, NULL, NULL, NULL, NULL, NULL, 1); |
---|
957 | tmpstr = gethttps(newurl, NULL, NULL, NULL, NULL, NULL, 1); |
---|
958 | } |
---|
959 | else |
---|
960 | { |
---|
961 | // new start |
---|
962 | cmd = ostrcat("/tmp/localhoster/hoster.sh get '", newurl, 0, 0); |
---|
963 | cmd = ostrcat(cmd, "'", 1, 0); |
---|
964 | debug(99, "cmd: %s", cmd); |
---|
965 | tmpstr = command(cmd); |
---|
966 | free(cmd), cmd = NULL; |
---|
967 | // new end |
---|
968 | } |
---|
969 | |
---|
970 | debug(99, "tmpstr: %s", tmpstr); |
---|
971 | free(newurl), newurl = NULL; |
---|
972 | |
---|
973 | if(tmpstr != NULL) |
---|
974 | { |
---|
975 | drawscreen(load, 0, 0); |
---|
976 | |
---|
977 | seriesid = string_resub("SeriesID=", "\"", tmpstr, 0); |
---|
978 | debug(99, "seriesid: %s", seriesid); |
---|
979 | |
---|
980 | pathnew = ostrcat("/aGET/MirrorByEpisode/&?Addr=", searchname, 0, 0); |
---|
981 | pathnew = ostrcat(pathnew, "&SeriesID=", 1, 0); |
---|
982 | pathnew = ostrcat(pathnew, seriesid, 1, 0); |
---|
983 | pathnew = ostrcat(pathnew, "&Season=", 1, 0); |
---|
984 | pathnew = ostrcat(pathnew, session, 1, 0); |
---|
985 | pathnew = ostrcat(pathnew, "&Episode=", 1, 0); |
---|
986 | pathnew = ostrcat(pathnew, episode, 1, 0); |
---|
987 | debug(99, "pathnew: %s", pathnew); |
---|
988 | |
---|
989 | free(tmpstr), tmpstr = NULL; |
---|
990 | // tmpstr = gethttp(getconfig("tithek_kinox_url", NULL, pathnew, 80, NULL, NULL, 10000, NULL, 0); |
---|
991 | newurl = ostrcat(getconfig("tithek_kinox_url", NULL), "/", 0, 0); |
---|
992 | newurl = ostrcat(newurl, pathnew, 1, 0); |
---|
993 | // tmpstr = gethttps(newurl, NULL, NULL, NULL, NULL, NULL, 1); |
---|
994 | // new start |
---|
995 | cmd = ostrcat("/tmp/localhoster/hoster.sh get '", newurl, 0, 0); |
---|
996 | cmd = ostrcat(cmd, "'", 1, 0); |
---|
997 | debug(99, "cmd: %s", cmd); |
---|
998 | tmpstr = command(cmd); |
---|
999 | free(cmd), cmd = NULL; |
---|
1000 | // new end |
---|
1001 | free(newurl), newurl = NULL; |
---|
1002 | |
---|
1003 | free(pathnew), pathnew = NULL; |
---|
1004 | |
---|
1005 | if(tmpstr != NULL) |
---|
1006 | { |
---|
1007 | tmpstr = string_resub("<ul id=\"HosterList\" class=\"Sortable\">", "</ul>", tmpstr, 0); |
---|
1008 | |
---|
1009 | int type = 14; |
---|
1010 | int count = 0; |
---|
1011 | int incount = 0; |
---|
1012 | int i; |
---|
1013 | struct splitstr* ret1 = NULL; |
---|
1014 | ret1 = strsplit(tmpstr, "\n", &count); |
---|
1015 | |
---|
1016 | char* hname = NULL; |
---|
1017 | char* hnr = NULL; |
---|
1018 | char* hlink = NULL; |
---|
1019 | |
---|
1020 | if(ret1 != NULL && count > 0) |
---|
1021 | { |
---|
1022 | int max = count; |
---|
1023 | for(i = 0; i < max; i++) |
---|
1024 | { |
---|
1025 | char *mirrormaxtmp = NULL; |
---|
1026 | char *pathnewtmp = NULL; |
---|
1027 | char *season = NULL; |
---|
1028 | int mirrormax = 1; |
---|
1029 | int j = 0; |
---|
1030 | |
---|
1031 | mirrormaxtmp = oregex("<b>Mirror</b>: .*/(.*)<br.*", ret1[i].part); |
---|
1032 | |
---|
1033 | if(mirrormaxtmp != NULL) |
---|
1034 | mirrormax = atoi(mirrormaxtmp); |
---|
1035 | free(mirrormaxtmp), mirrormaxtmp= NULL; |
---|
1036 | |
---|
1037 | debug(99, "### START ####################################################"); |
---|
1038 | |
---|
1039 | for(j = 1; j < mirrormax + 1; j++) |
---|
1040 | { |
---|
1041 | debug(99, "(%d/%d) (%d/%d) ret1[i].part: %s",i ,max ,j ,mirrormax, ret1[i].part); |
---|
1042 | |
---|
1043 | hnr = string_resub("<li id=\"Hoster_", "\"", ret1[i].part, 0); |
---|
1044 | |
---|
1045 | // hlink = string_resub("rel=\"", "amp;Mirror", ret1[i].part, 0); |
---|
1046 | // hlink = string_replace_all("amp;Hoster", "Hoster", hlink, 1); |
---|
1047 | // hlink = ostrcat(hlink, "Mirror=", 0, 0); |
---|
1048 | |
---|
1049 | ////////// |
---|
1050 | hlink = string_resub("rel=\"", "amp;Mirror", ret1[i].part, 0); |
---|
1051 | |
---|
1052 | if (hlink == NULL) |
---|
1053 | { |
---|
1054 | hlink = string_resub("rel=\"", "\">", ret1[i].part, 0); |
---|
1055 | hlink = string_replace_all("amp;Hoster", "Hoster", hlink, 1); |
---|
1056 | hname = string_resub("<div class=\"Named\">", "</div>", ret1[i].part, 0); |
---|
1057 | pathnewtmp = ostrcat(getconfig("tithek_kinox_url", NULL), "/aGET/Mirror/", 0, 0); |
---|
1058 | pathnewtmp = ostrcat(pathnewtmp, hlink, 1, 0); |
---|
1059 | pathnew = ostrcat(pathnewtmp, NULL, 0, 0); |
---|
1060 | } |
---|
1061 | else |
---|
1062 | { |
---|
1063 | hlink = string_replace_all("amp;Hoster", "Hoster", hlink, 1); |
---|
1064 | hlink = ostrcat(hlink, "Mirror=", 0, 0); |
---|
1065 | hname = string_resub("<div class=\"Named\">", "</div>", ret1[i].part, 0); |
---|
1066 | pathnewtmp = ostrcat(getconfig("tithek_kinox_url", NULL), "/aGET/Mirror/", 0, 0); |
---|
1067 | pathnewtmp = ostrcat(pathnewtmp, hlink, 1, 0); |
---|
1068 | pathnew = ostrcat(pathnewtmp, oitoa(j), 0, 1); |
---|
1069 | } |
---|
1070 | debug(99, "(%d/%d) (%d/%d)hnr: %s hlink: %s hname: %s pathnewtmp: %s",i ,max ,j ,mirrormax ,hnr ,hlink ,hname ,pathnewtmp); |
---|
1071 | free(pathnewtmp), pathnewtmp = NULL; |
---|
1072 | ////////// |
---|
1073 | // hname = string_resub("<div class=\"Named\">", "</div>", ret1[i].part, 0); |
---|
1074 | // pathnewtmp = ostrcat("/aGET/Mirror/", hlink, 0, 0); |
---|
1075 | |
---|
1076 | season = string_resub("&Season=", "\">", ret1[i].part, 0); |
---|
1077 | season = string_replace_all("amp;", "", season, 1); |
---|
1078 | |
---|
1079 | // pathnew = ostrcat(pathnewtmp, oitoa(j), 0, 1); |
---|
1080 | pathnew = ostrcat(pathnew, "&Season=", 1, 0); |
---|
1081 | pathnew = ostrcat(pathnew, season, 1, 0); |
---|
1082 | |
---|
1083 | debug(99, "(%d/%d) (%d/%d) hnr: %s hlink: %s season: %s hname: %s pathnewtmp: %s",i ,max ,j ,mirrormax ,hnr ,hlink ,season ,hname ,pathnewtmp); |
---|
1084 | |
---|
1085 | free(season), season= NULL; |
---|
1086 | free(pathnewtmp), pathnewtmp = NULL; |
---|
1087 | |
---|
1088 | pichname = ostrcat(hname, NULL, 0, 0); |
---|
1089 | string_tolower(pichname); |
---|
1090 | pichname = stringreplacecharonce(pichname, '.', '\0'); |
---|
1091 | |
---|
1092 | extra = string_resub("<b>Vom</b>: ", "</div>", ret1[i].part, 0); |
---|
1093 | |
---|
1094 | hlink = string_replace("kinox.to", "", hlink, 1); |
---|
1095 | hlink = string_replace(getconfig("tithek_kinox_url", NULL), "", hlink, 1); |
---|
1096 | hlink = string_replace("http:////Stream/", "", hlink, 1); |
---|
1097 | hlink = string_replace("http:///Stream/", "", hlink, 1); |
---|
1098 | hlink = string_replace("https:////Stream/", "", hlink, 1); |
---|
1099 | hlink = string_replace("https:///Stream/", "", hlink, 1); |
---|
1100 | |
---|
1101 | if(cloudflare == 0) |
---|
1102 | { |
---|
1103 | // tmpstr1 = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0); |
---|
1104 | tmpstr1 = gethttps(pathnew, NULL, NULL, NULL, NULL, NULL, 1); |
---|
1105 | } |
---|
1106 | else if(localhoster == 1) |
---|
1107 | { |
---|
1108 | cmd = ostrcat("/tmp/localhoster/hoster.sh hoster '", pathnew, 0, 0); |
---|
1109 | cmd = ostrcat(cmd, "'", 1, 0); |
---|
1110 | debug(99, "cmd: %s", cmd); |
---|
1111 | url = ostrcat(cmd, NULL, 0, 0); |
---|
1112 | } |
---|
1113 | else |
---|
1114 | { |
---|
1115 | // new start |
---|
1116 | cmd = ostrcat("/tmp/localhoster/hoster.sh get '", pathnew, 0, 0); |
---|
1117 | cmd = ostrcat(cmd, "'", 1, 0); |
---|
1118 | debug(99, "cmd: %s", cmd); |
---|
1119 | tmpstr1 = command(cmd); |
---|
1120 | free(cmd), cmd = NULL; |
---|
1121 | // new end |
---|
1122 | } |
---|
1123 | /* |
---|
1124 | // debug(99, "pathnew: %s", pathnew); |
---|
1125 | // tmpstr1 = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0); |
---|
1126 | // tmpstr1 = gethttps(pathnew, NULL, NULL, NULL, NULL, NULL, 1); |
---|
1127 | // new start |
---|
1128 | cmd = ostrcat("/tmp/localhoster/hoster.sh get '", pathnew, 0, 0); |
---|
1129 | cmd = ostrcat(cmd, "'", 1, 0); |
---|
1130 | debug(99, "cmd: %s", cmd); |
---|
1131 | tmpstr1 = command(cmd); |
---|
1132 | free(cmd), cmd = NULL; |
---|
1133 | // new end |
---|
1134 | // debug(99, "tmpstr1 1: %s", tmpstr1); |
---|
1135 | */ |
---|
1136 | tmpstr1 = string_replace_all("\\", "", tmpstr1, 1); |
---|
1137 | // debug(99, "tmpstr1 2: %s", tmpstr1); |
---|
1138 | |
---|
1139 | if(localhoster == 0) |
---|
1140 | { |
---|
1141 | if(ostrstr(tmpstr1, "<iframe src=") != NULL) |
---|
1142 | { |
---|
1143 | url = string_resub("<iframe src=\"", "\"", tmpstr1, 0); |
---|
1144 | // debug(99, "iframe1.1 url: %s", url); |
---|
1145 | } |
---|
1146 | else if(ostrstr(tmpstr1, "/iframe>") != NULL) |
---|
1147 | { |
---|
1148 | free(pathnew), pathnew = NULL; |
---|
1149 | pathnew = ostrcat(getconfig("tithek_kinox_url", NULL), "/aGET/Mirror/", 0, 0); |
---|
1150 | pathnew = ostrcat(pathnew, hlink, 1, 0); |
---|
1151 | // debug(99, "iframe2.1 pathnew: %s", pathnew); |
---|
1152 | free(tmpstr1), tmpstr1 = NULL; |
---|
1153 | // tmpstr1 = gethttps(pathnew, NULL, NULL, NULL, NULL, NULL, 1); |
---|
1154 | // new start |
---|
1155 | cmd = ostrcat("/tmp/localhoster/hoster.sh get '", pathnew, 0, 0); |
---|
1156 | cmd = ostrcat(cmd, "'", 1, 0); |
---|
1157 | debug(99, "cmd: %s", cmd); |
---|
1158 | tmpstr1 = command(cmd); |
---|
1159 | free(cmd), cmd = NULL; |
---|
1160 | // new end |
---|
1161 | // debug(99, "iframe2.2 tmpstr1: %s", tmpstr1); |
---|
1162 | tmpstr1 = string_replace_all("\\", "", tmpstr1, 1); |
---|
1163 | // debug(99, "iframe2.3 tmpstr1: %s", tmpstr1); |
---|
1164 | |
---|
1165 | if(ostrstr(tmpstr1, "<iframe src=") != NULL) |
---|
1166 | { |
---|
1167 | url = string_resub("<iframe src=\"", "\"", tmpstr1, 0); |
---|
1168 | // debug(99, "iframe2.4 url: %s", url); |
---|
1169 | } |
---|
1170 | } |
---|
1171 | else |
---|
1172 | { |
---|
1173 | tmpstr1 = string_resub("<a href=\"", "\"", tmpstr1, 0); |
---|
1174 | // debug(99, "tmpstr1 3: %s", tmpstr1); |
---|
1175 | url = ostrcat(tmpstr1, NULL, 0, 0); |
---|
1176 | } |
---|
1177 | } |
---|
1178 | |
---|
1179 | type = 14; |
---|
1180 | if(localhoster == 1) |
---|
1181 | type = 111; |
---|
1182 | |
---|
1183 | debug(99, "-------------------------------"); |
---|
1184 | debug(99, "(%d/%d) (%d/%d) %s url: %s extra: %s", i, max, j, mirrormax, hname, url, extra); |
---|
1185 | debug(99, "-------------------------------"); |
---|
1186 | |
---|
1187 | incount += 1; |
---|
1188 | |
---|
1189 | line = ostrcat(line, hname, 1, 0); |
---|
1190 | |
---|
1191 | if(url == NULL) |
---|
1192 | line = ostrcat(line, " (Error)", 1, 0); |
---|
1193 | |
---|
1194 | if(extra != NULL) |
---|
1195 | { |
---|
1196 | line = ostrcat(line, " (", 1, 0); |
---|
1197 | line = ostrcat(line, extra, 1, 0); |
---|
1198 | line = ostrcat(line, ")", 1, 0); |
---|
1199 | } |
---|
1200 | |
---|
1201 | line = ostrcat(line, " (Mirror ", 1, 0); |
---|
1202 | line = ostrcat(line, oitoa(j), 1, 1); |
---|
1203 | line = ostrcat(line, "/", 1, 0); |
---|
1204 | line = ostrcat(line, oitoa(mirrormax), 1, 1); |
---|
1205 | line = ostrcat(line, ")", 1, 0); |
---|
1206 | |
---|
1207 | |
---|
1208 | line = ostrcat(line, "#", 1, 0); |
---|
1209 | line = ostrcat(line, url, 1, 0); |
---|
1210 | line = ostrcat(line, "#", 1, 0); |
---|
1211 | line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/", 1, 0); |
---|
1212 | line = ostrcat(line, pichname, 1, 0); |
---|
1213 | line = ostrcat(line, ".jpg#kinox_", 1, 0); |
---|
1214 | line = ostrcat(line, pichname, 1, 0); |
---|
1215 | line = ostrcat(line, ".jpg#KinoX - ", 1, 0); |
---|
1216 | line = ostrcat(line, title, 1, 0); |
---|
1217 | line = ostrcat(line, "#", 1, 0); |
---|
1218 | line = ostrcat(line, oitoa(type), 1, 0); |
---|
1219 | line = ostrcat(line, "\n", 1, 0); |
---|
1220 | |
---|
1221 | free(tmpstr1), tmpstr1 = NULL; |
---|
1222 | free(tmpstr2), tmpstr2 = NULL; |
---|
1223 | free(hname), hname = NULL; |
---|
1224 | free(hnr), hnr = NULL; |
---|
1225 | free(hlink), hlink = NULL; |
---|
1226 | free(url), url = NULL; |
---|
1227 | free(pathnew), pathnew = NULL; |
---|
1228 | free(pichname), pichname = NULL; |
---|
1229 | free(extra), extra = NULL; |
---|
1230 | } |
---|
1231 | debug(99, "### END #####################################################"); |
---|
1232 | } |
---|
1233 | } |
---|
1234 | free(ret1), ret1 = NULL; |
---|
1235 | } |
---|
1236 | } |
---|
1237 | |
---|
1238 | free(tmpstr), tmpstr = NULL; |
---|
1239 | if(line != NULL) |
---|
1240 | { |
---|
1241 | line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1); |
---|
1242 | tmpstr = ostrcat("/tmp/tithek/kinox.hoster.series.", oitoa(time(NULL)), 0, 1); |
---|
1243 | tmpstr = ostrcat(tmpstr, ".list", 1, 0); |
---|
1244 | |
---|
1245 | writesys(tmpstr, line, 0); |
---|
1246 | |
---|
1247 | titheklog(debuglevel, "/tmp/kinox9_line", NULL, NULL, NULL, line); |
---|
1248 | |
---|
1249 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
1250 | createtithek(tnode, tnode->title, tmpstr, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag); |
---|
1251 | ret = 0; |
---|
1252 | } |
---|
1253 | |
---|
1254 | return ret; |
---|
1255 | } |
---|
1256 | |
---|
1257 | int kinox_search_cast(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title, char* searchstr) |
---|
1258 | { |
---|
1259 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
1260 | int ret = 1; |
---|
1261 | |
---|
1262 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
1263 | return ret; |
---|
1264 | |
---|
1265 | char* search = NULL; |
---|
1266 | if(searchstr == NULL) |
---|
1267 | search = textinputhist(_("Search"), " ", "searchhist"); |
---|
1268 | else |
---|
1269 | search = textinputhist(_("Search"), searchstr, "searchhist"); |
---|
1270 | |
---|
1271 | if(search != NULL) |
---|
1272 | { |
---|
1273 | drawscreen(load, 0, 0); |
---|
1274 | search = strstrip(search); |
---|
1275 | search = stringreplacechar(search, ' ', '+'); |
---|
1276 | debug(99, "search: %s", search); |
---|
1277 | |
---|
1278 | char* tmpstr = NULL; |
---|
1279 | char* tmpstr1 = NULL; |
---|
1280 | char* ip = NULL; |
---|
1281 | char* path = NULL; |
---|
1282 | |
---|
1283 | char* line = NULL; |
---|
1284 | char* menu = NULL; |
---|
1285 | |
---|
1286 | ip = ostrcat("www.imdb.com", NULL, 0, 0); |
---|
1287 | path = ostrcat("find?q=", search, 0, 0); |
---|
1288 | path = ostrcat(path, "&s=nm", 1, 0); |
---|
1289 | |
---|
1290 | tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0); |
---|
1291 | titheklog(debuglevel, "/tmp/kinox10_cast_tmpstr1", NULL, NULL, NULL, tmpstr); |
---|
1292 | tmpstr = string_replace_all("<td class=\"primary_photo\"> <a href=\"/name/", "\nfound=\"", tmpstr, 1); |
---|
1293 | titheklog(debuglevel, "/tmp/kinox10_cast_tmpstr2", NULL, NULL, NULL, tmpstr); |
---|
1294 | |
---|
1295 | tmpstr1 = string_resub("<table class=\"findList\">", "</div>", tmpstr, 0); |
---|
1296 | titheklog(debuglevel, "/tmp/kinox10_cast_tmpstr3", NULL, NULL, NULL, tmpstr1); |
---|
1297 | free(tmpstr), tmpstr = NULL; |
---|
1298 | |
---|
1299 | int count = 0; |
---|
1300 | int incount = 0; |
---|
1301 | int i; |
---|
1302 | struct splitstr* ret1 = NULL; |
---|
1303 | ret1 = strsplit(tmpstr1, "\n", &count); |
---|
1304 | |
---|
1305 | char* url = NULL; |
---|
1306 | char* pic = NULL; |
---|
1307 | char* name = NULL; |
---|
1308 | |
---|
1309 | if(ret1 != NULL && count > 0) |
---|
1310 | { |
---|
1311 | int max = count; |
---|
1312 | for(i = 0; i < max; i++) |
---|
1313 | { |
---|
1314 | url = string_resub("found=\"", "/", ret1[i].part, 0); |
---|
1315 | pic = string_resub("<img src=\"", "\"", ret1[i].part, 0); |
---|
1316 | |
---|
1317 | tmpstr = string_resub("found=\"", "<small>", ret1[i].part, 0); |
---|
1318 | // name = oregex(".*<a href=\"/name/nm.*\ >(.*)</a>", tmpstr); |
---|
1319 | name = oregex(".*<a href=\"/name/nm.* >(.*)</a>", tmpstr); |
---|
1320 | |
---|
1321 | debug(99, "(%d/%d) name: %s url: %s pic: %s\n",i, count, name, url, pic); |
---|
1322 | debug(99, "-------------------------------"); |
---|
1323 | |
---|
1324 | pic = string_replace_all(",", "%2C", pic, 1); |
---|
1325 | |
---|
1326 | if(url != NULL) |
---|
1327 | { |
---|
1328 | incount++; |
---|
1329 | line = ostrcat(line, name, 1, 0); |
---|
1330 | line = ostrcat(line, "#", 1, 0); |
---|
1331 | line = ostrcat(line, getconfig("tithek_kinox_url", NULL), 1, 0); |
---|
1332 | line = ostrcat(line, "/People/", 1, 0); |
---|
1333 | line = ostrcat(line, url, 1, 0); |
---|
1334 | line = ostrcat(line, "#", 1, 0); |
---|
1335 | line = ostrcat(line, pic, 1, 0); |
---|
1336 | line = ostrcat(line, "#kinox_search_", 1, 0); |
---|
1337 | line = ostrcat(line, oitoa(incount + time(NULL)), 1, 1); |
---|
1338 | line = ostrcat(line, ".jpg#KinoX - Cast Search#32\n", 1, 0); |
---|
1339 | } |
---|
1340 | |
---|
1341 | free(url), url = NULL; |
---|
1342 | free(pic), pic = NULL; |
---|
1343 | free(name), name = NULL; |
---|
1344 | free(tmpstr), tmpstr = NULL; |
---|
1345 | } |
---|
1346 | |
---|
1347 | free(ret1), ret1 = NULL; |
---|
1348 | if(line != NULL) |
---|
1349 | { |
---|
1350 | line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1); |
---|
1351 | menu = ostrcat("/tmp/tithek/kinox.search.cast.", oitoa(time(NULL)), 0, 1); |
---|
1352 | menu = ostrcat(menu, ".list", 1, 0); |
---|
1353 | |
---|
1354 | writesys(menu, line, 0); |
---|
1355 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
1356 | createtithek(tnode, tnode->title, menu, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag); |
---|
1357 | ret = 0; |
---|
1358 | } |
---|
1359 | |
---|
1360 | } |
---|
1361 | free(tmpstr), tmpstr = NULL; |
---|
1362 | free(ip), ip = NULL; |
---|
1363 | } |
---|
1364 | free(search), search = NULL; |
---|
1365 | return ret; |
---|
1366 | } |
---|
1367 | |
---|
1368 | #endif |
---|