source: titan/plugins/tithek/kinox.h @ 18069

Last change on this file since 18069 was 18069, checked in by obi, 12 years ago

[titan] update tithek

File size: 16.0 KB
Line 
1#ifndef KINOX_H
2#define KINOX_H
3
4// flag 1 = putlocker/sockshare
5// flag 2 = filenuke
6
7char* kinox(char* link, char* url, char* name, int flag)
8{
9        debug(99, "link(%d): %s", flag, link);
10        char* video_id = NULL, *source = NULL, *streamurl = NULL;
11
12        if(flag == 1 || flag == 2 || flag == 3)
13        {
14                int count = 0;
15                struct splitstr* ret1 = NULL;
16                ret1 = strsplit(link, ";", &count);
17                if(ret1 != NULL && count >= 3)
18                {                       
19                        video_id = ostrcat(video_id, ret1[1].part, 1, 0);
20                        debug(99, "video_id: %s", video_id);
21
22                        source = ostrcat(source, ret1[2].part, 1, 0);
23                        debug(99, "source: %s", source);
24
25                        if(flag == 1)
26                                streamurl = putlocker(source, video_id);
27                        else if(flag == 2)
28                                streamurl = filenuke(source, video_id);
29                        else if(flag == 3)
30                                streamurl = streamcloud(source, video_id);
31
32                        debug(99, "streamurl1: %s", streamurl);
33
34                        streamurl = string_replace_all("amp;", "", streamurl, 1);
35                        debug(99, "streamurl2: %s", streamurl);
36                }
37                free(ret1), ret1 = NULL;
38        }
39        free(video_id), video_id = NULL;
40        free(source), source = NULL;
41
42        return streamurl;
43}
44
45void kinox_search(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title)
46{
47        char* search = textinputhist("Search", "NULL", "searchhist");
48               
49        if(search != NULL)
50        {
51                drawscreen(load, 0, 0);
52                search = stringreplacechar(search, ' ', '+');
53                char* tmpstr = NULL;
54                char* tmpstr1 = NULL;
55                char* line = NULL;
56                char* pic = NULL;
57                char* title = NULL;     
58                char* lang = NULL;
59                char* langck = NULL;
60                char* from = NULL;
61                char* url = NULL;
62                char* ip = NULL;
63                char* path = NULL;
64                char* menu = NULL;
65
66                ip = ostrcat("kinox.to", NULL, 0, 0);
67                path = ostrcat("Search.html?q=", search, 0, 0);
68       
69                tmpstr = gethttp(ip, path, 80, NULL, NULL, NULL, 0);
70                tmpstr = string_resub("<div id=\"beep\" class=\"beep\"></div>", "</table>", tmpstr, 0);
71
72                int count = 0;
73                int incount = 0;
74                int i = 0;
75                struct splitstr* ret1 = NULL;
76                ret1 = strsplit(tmpstr, "\n", &count);
77
78                if(ret1 != NULL)
79                {
80                        int max = count;
81                        for(i = 0; i < max; i++)
82                        {
83                                if(oregex(".*src=\"/gr/sys/lng/(.*)\" alt=\"language\"></td>.*", ret1[i].part) != NULL)
84                                {
85                                        free(langck), langck = NULL;
86                                        langck = oregex(".*src=\"/gr/sys/lng/(.*)\" alt=\"language\"></td>.*", ret1[i].part);
87                                }
88                               
89                                if(oregex(".*<td class=\"Title\"><a href=\"(.*)\" onclick=.*", ret1[i].part) != NULL)
90                                {
91                                        free(path), path = NULL;
92                                        path = oregex(".*<td class=\"Title\"><a href=\"(.*)\" onclick=.*", ret1[i].part);
93
94                                        if(ostrstr(langck, "1.png") != NULL)
95                                                lang = ostrcat(lang, " (de)", 1, 0);
96                                        else if(ostrstr(langck, "2.png") != NULL)
97                                                lang = ostrcat(lang, " (en)", 1, 0);
98                                        else
99                                                lang = ostrcat(lang, " (\?\?)", 1, 0);
100                                                                                                                                       
101                                        tmpstr1 = gethttp("kinox.to", path, 80, NULL, NULL, NULL, 0);
102
103                                        from = ostrcat("<div class=\"Grahpics\"><a href=\"", path, 0, 0);
104                                        from = ostrcat(from, "\"><img src=\"", 1, 0);
105
106                                        pic = string_resub(from, "\" alt=\"", tmpstr1, 0);
107                                       
108                                        if(pic == NULL)
109                                                pic = ostrcat("dummy", NULL, 0, 0);
110
111                                        title = ostrcat(path, NULL, 0, 0);
112                                        title = string_replace_all("/Stream/", "", title, 1);
113                                        title = string_replace_all(".html", "", title, 1);
114                                        title = stringreplacechar(title, '_', ' ');
115                                        title = ostrcat(title , lang, 1, 0);
116
117                                        url = ostrcat("http://kinox.to", path, 0, 0);
118
119                                        debug(99, "---------------------------");
120                                        debug(99, "langck: %s", langck);
121                                        debug(99, "pic: %s", pic);
122                                        debug(99, "title: %s", title);
123                                        debug(99, "url: %s", url);                                     
124                                        debug(99, "---------------------------");
125
126                                        if(url != NULL)
127                                        {
128                                                incount += 1;
129                                                line = ostrcat(line, title, 1, 0);
130                                                line = ostrcat(line, "#", 1, 0);
131                                                line = ostrcat(line, url, 1, 0);
132                                                line = ostrcat(line, "#", 1, 0);
133                                                line = ostrcat(line, pic, 1, 0);
134                                                line = ostrcat(line, "#kinox_search_", 1, 0);
135                                                line = ostrcat(line, oitoa(incount + time(NULL)), 1, 0);
136                                                line = ostrcat(line, ".jpg#KinoX - Search#22\n", 1, 0);
137                                        }
138                                        free(url), url = NULL;
139                                        free(path), path = NULL;
140                                        free(title), title = NULL;
141                                        free(pic), pic = NULL;         
142                                        free(from), from = NULL;
143                                        free(tmpstr1), tmpstr1 = NULL;
144                                        free(lang), lang = NULL;
145                                        free(langck), langck = NULL;   
146                                }
147                        }
148                        free(ret1), ret1 = NULL;
149                        if(line != NULL)
150                        {
151                                menu = ostrcat("/tmp/tithek/kinox.search.list", NULL, 0, 0);
152                                writesys(menu, line, 0);
153                                ((struct tithek*)listbox->select->handle)->link = menu;
154                        }
155
156                }
157                free(tmpstr), tmpstr = NULL;
158                free(ip), ip = NULL;
159        }
160        free(search), search = NULL;
161}
162
163void kinox_hoster(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title)
164{
165        debug(99, "link: %s", link);
166        char* ip = NULL, *pos = NULL, *path = NULL, *tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL, *line = NULL, *url = NULL, *pathnew = NULL;               
167        ip = string_replace("http://", "", (char*)link, 0);
168
169        if(ip != NULL)
170                pos = strchr(ip, '/');
171        if(pos != NULL)
172        {
173                pos[0] = '\0';
174                path = pos + 1;
175        }
176
177        tmpstr = gethttp(ip, path, 80, NULL, NULL, NULL, 0);
178
179        if(ostrstr(tmpstr, "SeriesID") != NULL)
180        {
181                char* pos1 = NULL;
182                char* from = NULL;
183                char* folgen = NULL;
184                int i;
185       
186                for(i = 1; i < 30; i++)
187                {
188                        from = ostrcat(from, "<option value=\"", 1, 0);
189                        from = ostrcat(from, oitoa(i), 1, 0);
190                        from = ostrcat(from, "\" rel=", 1, 0);
191               
192                        pos1 = ostrstr(tmpstr, from);
193                        folgen = getxmlentry(ostrstr(tmpstr, from), "rel=");
194                        printf("session %d folgen: %s\n",i , folgen);   
195       
196
197                        if(folgen != NULL)
198                        {
199                                int count = 0;
200                                int incount = 0;
201                                int j;
202                                struct splitstr* ret1 = NULL;
203                                ret1 = strsplit(folgen, ",", &count);
204                                       
205                                if(ret1 != NULL && count > 0)
206                                {
207                                        int max = count + 1;
208                                        for(j = 1; j < max; j++)
209                                        {                                                       
210                                                incount += 1;
211                                                line = ostrcat(line, _("Session"), 1, 0);
212                                                line = ostrcat(line, " ", 1, 0);
213                                                line = ostrcat(line, oitoa(i), 1, 0);
214                                                line = ostrcat(line, " ", 1, 0);
215                                                line = ostrcat(line, _("Episode"), 1, 0);
216                                                line = ostrcat(line, " ", 1, 0);
217                                                line = ostrcat(line, oitoa(j), 1, 0);                                   
218                                                line = ostrcat(line, "#", 1, 0);
219                                                line = ostrcat(line, link, 1, 0);
220                                                line = ostrcat(line, ";", 1, 0);
221                                                line = ostrcat(line, oitoa(i), 1, 0);
222                                                line = ostrcat(line, ";", 1, 0);
223                                                line = ostrcat(line, oitoa(j), 1, 0);
224                                                line = ostrcat(line, "#", 1, 0);
225                                                line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/s", 1, 0);
226                                                line = ostrcat(line, oitoa(i), 1, 0);
227                                                line = ostrcat(line, "e", 1, 0);
228                                                line = ostrcat(line, oitoa(j), 1, 0);
229                                                line = ostrcat(line, ".jpg", 1, 0);                                                                                                                             
230                                                line = ostrcat(line, "#kinox_search_", 1, 0);
231                                                line = ostrcat(line, oitoa(i), 1, 0);
232                                                line = ostrcat(line, "e", 1, 0);
233                                                line = ostrcat(line, oitoa(j), 1, 0);
234                                                line = ostrcat(line, ".jpg#KinoX - ", 1, 0);
235                                                line = ostrcat(line, title, 1, 0);
236                                                line = ostrcat(line, "#23\n", 1, 0);
237                                        }
238                                }
239                                free(ret1), ret1 = NULL;
240                        }                               
241                        free(from), from = NULL;
242                        free(folgen), folgen = NULL;
243                }
244        }
245        else
246        {
247                tmpstr = string_resub("<ul id=\"HosterList\" class=\"Sortable\">", "</ul>", tmpstr, 0);
248
249                int count = 0;
250                int incount = 0;
251                int i;
252                struct splitstr* ret1 = NULL;
253                ret1 = strsplit(tmpstr, "\n", &count);
254
255                char* hname = NULL;
256                char* hnr = NULL;
257                char* hlink = NULL;
258               
259                if(ret1 != NULL && count > 0)
260                {
261                        int max = count;
262                        for(i = 0; i < max; i++)
263                        {
264                                hnr = string_resub("<li id=\"Hoster_", "\"", ret1[i].part, 0);
265                                hlink = string_resub("rel=\"", "\">", ret1[i].part, 0);
266                                hlink = string_replace_all("amp;", "", hlink, 1);
267
268                                hname = string_resub("<div class=\"Named\">", "</div>", ret1[i].part, 0);
269                                pathnew = ostrcat("/aGET/Mirror/", hlink, 0, 0);
270
271                                tmpstr1 = gethttp("kinox.to", pathnew, 80, NULL, NULL, NULL, 0);
272                                free(pathnew), pathnew = NULL;
273
274                                tmpstr1 = string_replace_all("\\", "", tmpstr1, 1);
275                                tmpstr1 = string_resub("<a href=\"", "\"", tmpstr1, 0);
276
277                                url = ostrcat(tmpstr1, NULL, 0, 0);
278                                int type = 0;
279                                int count2 = 0;
280                                struct splitstr* ret2 = NULL;
281                                ret2 = strsplit(tmpstr1, "/", &count2);
282
283                                if(ret2 != NULL && count2 > 3 && ostrcmp(hname, "Sockshare.com") == 0)
284                                {
285                                        tmpstr2 = ret2[3].part;
286                                        type = 14;
287                                }
288                                else if(ret2 != NULL && count2 > 3 && ostrcmp(hname, "Putlocker.com") == 0)
289                                {
290                                        tmpstr2 = ret2[3].part;
291                                        type = 14;
292                                }
293                                else if(ret2 != NULL && count2 > 2 && ostrcmp(hname, "FileNuke.com") == 0)
294                                {
295                                        tmpstr2 = ret2[2].part;
296                                        type = 15;
297                                }
298                                else if(ret2 != NULL && count2 > 2 && ostrcmp(hname, "StreamCloud.eu") == 0)
299                                {
300                                        tmpstr2 = ret2[2].part;
301                                        type = 20;
302                                }
303                                else if(ret2 != NULL && count2 > 3 && ostrcmp(hname, "VidStream.in") == 0)
304                                {
305                                        tmpstr2 = ret2[3].part;
306                                }
307                                else if(ret2 != NULL && count2 > 3 && ostrcmp(hname, "FlashX.tv") == 0)
308                                {
309                                        tmpstr2 = ret2[3].part;
310                                }
311                                else if(ret2 != NULL && count2 > 3 && ostrcmp(hname, "PrimeShare.tv") == 0)
312                                {
313                                        tmpstr2 = ret2[3].part;
314                                }                               
315                                else if(ret2 != NULL && count2 > 3 && ostrcmp(hname, "XvidStage.com") == 0)
316                                {
317                                        tmpstr2 = ret2[3].part;
318                                }
319                                else if(ret2 != NULL && count2 > 3 && ostrcmp(hname, "Vidxden.com (DivX)") == 0)
320                                {
321                                        tmpstr2 = ret2[3].part;
322                                }                               
323                                else
324                                {
325                                        tmpstr2 = ret2[2].part;
326                                        hname = ostrcat(hname, " (coming soon)", 1, 0);
327                                        type = 66;
328                                }
329
330                                free(ret2), ret2 = NULL;
331                                debug(99, "hname: %s", hname);
332                                debug(99, "url: %s", url);
333                                debug(99, "id: %s", tmpstr2);
334                                debug(99, "hname: %s", hname);
335                                                                       
336                                incount += 1;
337                                line = ostrcat(line, hname, 1, 0);
338                                line = ostrcat(line, "#", 1, 0);
339                                line = ostrcat(line, url, 1, 0);
340                                line = ostrcat(line, ";", 1, 0);
341                                line = ostrcat(line, tmpstr2, 1, 0);
342                                line = ostrcat(line, ";", 1, 0);                               
343                                line = ostrcat(line, hname, 1, 0);
344                                line = ostrcat(line, "#", 1, 0);
345                                line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/", 1, 0);
346                                line = ostrcat(line, hname, 1, 0);
347                                line = ostrcat(line, ".jpg#kinox_", 1, 0);
348                                line = ostrcat(line, hname, 1, 0);
349                                line = ostrcat(line, ".jpg#KinoX - ", 1, 0);
350                                line = ostrcat(line, title, 1, 0);
351                                line = ostrcat(line, "#", 1, 0);
352                                line = ostrcat(line, oitoa(type), 1, 0);
353                                line = ostrcat(line, "\n", 1, 0);
354       
355                                free(hname), hname = NULL;
356                                free(hnr), hnr = NULL;
357                                free(hlink), hlink = NULL;                                                                             
358                                free(url), url = NULL;
359                                free(pathnew), pathnew = NULL;
360                        }
361                }
362                free(ret1), ret1 = NULL;
363        }
364
365        free(tmpstr), tmpstr = NULL;   
366        if(line != NULL)
367        {
368                tmpstr = ostrcat("/tmp/tithek/kinox.hoster.list", NULL, 0, 0);
369                writesys(tmpstr, line, 0);
370                ((struct tithek*)listbox->select->handle)->link = tmpstr;
371        }       
372}
373
374void kinox_hoster_series(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title)
375{
376        debug(99, "link: %s", link);
377        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;               
378
379        int count0 = 0;
380        struct splitstr* ret0 = NULL;
381        ret0 = strsplit(link, ";", &count0);
382        if(ret0 != NULL && count0 >= 3)
383        {
384                url = ostrcat(url, ret0[0].part, 1, 0);
385                debug(99, "url: %s", url);
386
387                session = ostrcat(session, ret0[1].part, 1, 0);
388                debug(99, "session: %s", session);
389
390                episode = ostrcat(episode, ret0[2].part, 1, 0);
391                debug(99, "episode: %s", episode);
392
393                searchname = ostrcat(searchname, ret0[0].part, 1, 0);
394                searchname = string_replace("http://kinox.to//Stream/", "", searchname, 0);
395                searchname = string_replace(".html", "", searchname, 0);
396                debug(99, "searchname: %s", searchname);
397        }
398        free(ret0), ret0 = NULL;
399
400        ip = string_replace("http://", "", url, 0);
401
402        if(ip != NULL)
403                pos = strchr(ip, '/');
404        if(pos != NULL)
405        {
406                pos[0] = '\0';
407                path = pos + 1;
408        }
409
410        tmpstr = gethttp(ip, path, 80, NULL, NULL, NULL, 0);
411        writesys("/var/usr/local/share/titan/plugins/tithek/tmpstr1", tmpstr, 0);
412
413        seriesid = string_resub("SeriesID=", "\"", tmpstr, 0);
414        debug(99, "seriesid: %s", seriesid);
415               
416        pathnew = ostrcat("/aGET/MirrorByEpisode/&?Addr=", searchname, 0, 0);
417        pathnew = ostrcat(pathnew, "&SeriesID=", 1, 0);
418        pathnew = ostrcat(pathnew, seriesid, 1, 0);
419        pathnew = ostrcat(pathnew, "&Season=", 1, 0);
420        pathnew = ostrcat(pathnew, session, 1, 0);
421        pathnew = ostrcat(pathnew, "&Episode=", 1, 0);
422        pathnew = ostrcat(pathnew, episode, 1, 0);
423        debug(99, "pathnew: %s", pathnew);
424
425        free(tmpstr), tmpstr = NULL;
426        tmpstr = gethttp("kinox.to", pathnew, 80, NULL, NULL, NULL, 0);
427        free(pathnew), pathnew = NULL;
428
429        if(tmpstr != NULL)
430        {
431                tmpstr = string_resub("<ul id=\"HosterList\" class=\"Sortable\">", "</ul>", tmpstr, 0);
432       
433                int count = 0;
434                int incount = 0;
435                int i;
436                struct splitstr* ret1 = NULL;
437                ret1 = strsplit(tmpstr, "\n", &count);
438       
439                char* hname = NULL;
440                char* hnr = NULL;
441                char* hlink = NULL;
442               
443                if(ret1 != NULL && count > 0)
444                {
445                        int max = count;
446                        for(i = 0; i < max; i++)
447                        {
448                                hnr = string_resub("<li id=\"Hoster_", "\"", ret1[i].part, 0);
449                                hlink = string_resub("rel=\"", "\">", ret1[i].part, 0);
450                                hlink = string_replace_all("amp;", "", hlink, 1);
451                                hname = string_resub("<div class=\"Named\">", "</div>", ret1[i].part, 0);
452                                pathnew = ostrcat("/aGET/Mirror/", hlink, 0, 0);
453                                debug(99, "pathnew: %s", pathnew);
454
455                                tmpstr1 = gethttp("kinox.to", pathnew, 80, NULL, NULL, NULL, 0);
456                                tmpstr1 = string_replace_all("\\", "", tmpstr1, 1);
457                                tmpstr1 = string_resub("<a href=\"", "\"", tmpstr1, 0);
458
459                                url = ostrcat(tmpstr1, NULL, 0, 0);
460                                int type = 0;
461                                int count2 = 0;
462                                struct splitstr* ret2 = NULL;
463                                ret2 = strsplit(tmpstr1, "/", &count2);
464       
465                                if(ret2 != NULL && count2 > 3 && ostrcmp(hname, "Sockshare.com") == 0)
466                                {
467                                        tmpstr2 = ret2[3].part;
468                                        type = 14;
469                                }
470                                else if(ret2 != NULL && count2 > 3 && ostrcmp(hname, "Putlocker.com") == 0)
471                                {
472                                        tmpstr2 = ret2[3].part;
473                                        type = 14;
474                                }
475                                else if(ret2 != NULL && count2 > 2 && ostrcmp(hname, "FileNuke.com") == 0)
476                                {
477                                        tmpstr2 = ret2[2].part;
478                                        type = 15;
479                                }
480                                else if(ret2 != NULL && count2 > 2 && ostrcmp(hname, "StreamCloud.eu") == 0)
481                                {
482                                        tmpstr2 = ret2[2].part;
483                                        type = 20;
484                                }
485                                else if(ret2 != NULL && count2 > 3 && ostrcmp(hname, "VidStream.in") == 0)
486                                {
487                                        tmpstr2 = ret2[3].part;
488                                }
489                                else if(ret2 != NULL && count2 > 3 && ostrcmp(hname, "FlashX.tv") == 0)
490                                {
491                                        tmpstr2 = ret2[3].part;
492                                }
493                                else if(ret2 != NULL && count2 > 3 && ostrcmp(hname, "PrimeShare.tv") == 0)
494                                {
495                                        tmpstr2 = ret2[3].part;
496                                }                               
497                                else if(ret2 != NULL && count2 > 3 && ostrcmp(hname, "XvidStage.com") == 0)
498                                {
499                                        tmpstr2 = ret2[3].part;
500                                }
501                                else if(ret2 != NULL && count2 > 3 && ostrcmp(hname, "Vidxden.com (DivX)") == 0)
502                                {
503                                        tmpstr2 = ret2[3].part;
504                                }                               
505                                else
506                                {
507                                        tmpstr2 = ret2[2].part;
508                                        hname = ostrcat(hname, " (coming soon)", 1, 0);
509                                        type = 66;
510                                }
511                               
512                                free(ret2), ret2 = NULL;
513                                debug(99, "hname: %s", hname);
514                                debug(99, "url: %s", url);
515                                debug(99, "id: %s", tmpstr2);
516                                debug(99, "hname: %s", hname);
517                                                                                                                                               
518                                incount += 1;
519                                line = ostrcat(line, hname, 1, 0);
520                                line = ostrcat(line, "#", 1, 0);
521                                line = ostrcat(line, url, 1, 0);
522                                line = ostrcat(line, ";", 1, 0);
523                                line = ostrcat(line, tmpstr2, 1, 0);
524                                line = ostrcat(line, ";", 1, 0);                               
525                                line = ostrcat(line, hname, 1, 0);
526                                line = ostrcat(line, "#", 1, 0);
527                                line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/", 1, 0);
528                                line = ostrcat(line, hname, 1, 0);
529                                line = ostrcat(line, ".jpg#kinox_", 1, 0);
530                                line = ostrcat(line, hname, 1, 0);
531                                line = ostrcat(line, ".jpg#KinoX - ", 1, 0);
532                                line = ostrcat(line, title, 1, 0);
533                                line = ostrcat(line, "#", 1, 0);
534                                line = ostrcat(line, oitoa(type), 1, 0);
535                                line = ostrcat(line, "\n", 1, 0);
536       
537                                free(hname), hname = NULL;
538                                free(hnr), hnr = NULL;
539                                free(hlink), hlink = NULL;                                                                             
540                                free(url), url = NULL; 
541                                free(pathnew), pathnew = NULL;
542                        }
543                }
544                free(ret1), ret1 = NULL;
545        }
546
547        free(tmpstr), tmpstr = NULL;   
548        if(line != NULL)
549        {
550                tmpstr = ostrcat("/tmp/tithek/kinox.hoster.series.list", NULL, 0, 0);
551                writesys(tmpstr, line, 0);
552                ((struct tithek*)listbox->select->handle)->link = tmpstr;
553        }       
554}
555
556#endif
Note: See TracBrowser for help on using the repository browser.