source: titan/plugins/tithek/xvidstage.h @ 43231

Last change on this file since 43231 was 38825, checked in by obi, 8 years ago

update tithek

File size: 3.4 KB
Line 
1#ifndef XVIDSTAGE_H
2#define XVIDSTAGE_H
3
4char* xvidstage(char* link)
5{
6        debug(99, "link: %s", link);
7        int debuglevel = getconfigint("debuglevel", NULL);
8        char* url = NULL, *tmphost = NULL, *error = NULL, *tmppath = NULL, *tmpstr = NULL, *send = NULL, *id = NULL, *fname = NULL, *hashmsg = NULL, *hash = NULL, *hashlen = NULL, *ip = NULL, *streamlink = NULL;
9
10        if(link == NULL) return NULL;
11
12        unlink("/tmp/xvidstage1_get");
13        unlink("/tmp/xvidstage2_get_jsunpack");
14        unlink("/tmp/xvidstage3_streamlink");
15/////////////
16        char* tmplink = NULL, *pos = NULL, *path = NULL;
17
18        tmplink = ostrcat(link, NULL, 0, 0);
19
20        if(ostrstr(link, "/Out/?s=") != NULL)
21        {
22                tmplink = string_replace("/Out/?s=", "", tmplink, 1);
23                debug(99, "remove out string: %s", tmplink);
24        }
25
26
27        if(tmplink == NULL || ostrncmp("http", tmplink, 4))
28        {
29                textbox(_("Message"), _("Hoster Url not http:// or https://") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
30                goto end;
31        }
32
33        tmphost = string_replace("http://", "", tmplink, 0);
34        tmphost = string_replace("https://", "", tmphost, 1);
35        free(tmplink) , tmplink = NULL;
36
37        if(tmphost != NULL)
38                pos = strchr(tmphost, '/');
39        if(pos != NULL)
40        {
41                pos[0] = '\0';
42                path = pos + 1;
43        }
44
45        url = ostrcat(tmphost, "/embed-", 0, 0);
46        url = ostrcat(url, path, 1, 0);
47        url = ostrcat(url, ".html", 1, 0);
48
49//      free(path), path = NULL;
50
51        tmpstr = gethttps(url, NULL, NULL, NULL, NULL, NULL, 1);
52        titheklog(debuglevel, "/tmp/xvidstage1_get", NULL, NULL, NULL, tmpstr);
53
54        tmpstr = jsunpack(tmpstr);
55        titheklog(debuglevel, "/tmp/xvidstage2_get_jsunpack", NULL, NULL, NULL, tmpstr);       
56
57        if(tmpstr == NULL)
58        {
59                textbox(_("Message"), _("The page is temporarily unavailable") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
60                goto end;
61        }
62
63        if(ostrstr(tmpstr, "404 Not Found") != NULL)
64        {
65                textbox(_("Message"), _("The video no longer exists") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
66                goto end;
67        }
68
69        if(ostrstr(tmpstr, "File was deleted") != NULL)
70        {
71                textbox(_("Message"), _("The video no longer exists") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
72                goto end;
73        }
74
75        if(ostrstr(tmpstr, "Video is processing now.") != NULL)
76        {
77                textbox(_("Message"), _("Video is processing now. Conversion stage...") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
78                goto end;
79        }
80
81//      streamlink = string_resub("[{l:\"", "\"", tmpstr, 0);           
82        streamlink = oregex(".*(http://.*video.mkv).*", tmpstr);
83        if(streamlink == NULL)
84                streamlink = oregex(".*(http://.*video.mp4).*", tmpstr);
85        if(streamlink == NULL)
86                streamlink = oregex(".*(http://.*video.avi).*", tmpstr);
87        if(streamlink == NULL)
88                streamlink = oregex(".*(http://.*video.flv).*", tmpstr);
89
90        titheklog(debuglevel, "/tmp/xvidstage3_streamlink", NULL, NULL, NULL, streamlink);
91
92        free(tmpstr); tmpstr = NULL;
93
94end:
95
96        free(error); error = NULL;
97        free(tmphost); tmphost = NULL;
98        free(tmppath); tmppath = NULL;
99        free(tmpstr); tmpstr = NULL;
100        free(send); send = NULL;
101        free(hash), hash = NULL;
102        free(hashlen), hashlen = NULL;
103        free(hashmsg), hashmsg = NULL;
104        free(id), id = NULL;
105        free(fname), fname = NULL;
106        free(ip); ip = NULL;
107
108        return streamlink;
109}
110
111#endif
Note: See TracBrowser for help on using the repository browser.