source: titan/plugins/tithek/vidzi.h @ 37474

Last change on this file since 37474 was 37474, checked in by obi, 7 years ago

[tithek] fix xvidstage hoster

File size: 2.9 KB
Line 
1#ifndef VIDZI_H
2#define VIDZI_H
3
4char* vidzi(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/vidzi1_get");
13        unlink("/tmp/vidzi2_get");
14        unlink("/tmp/vidzi3_get_jsunpack");
15        unlink("/tmp/vidzi4_streamlink");
16/////////////
17        char* tmplink = NULL, *pos = NULL, *path = NULL;
18
19        tmplink = ostrcat(link, NULL, 0, 0);
20
21        if(ostrstr(link, "/Out/?s=") != NULL)
22        {
23                tmplink = string_replace("/Out/?s=", "", tmplink, 1);
24                debug(99, "remove out string: %s", tmplink);
25        }
26
27
28        if(tmplink == NULL || ostrncmp("http://", tmplink, 7))
29        {
30                textbox(_("Message"), _("Hoster Url not http://") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
31                goto end;
32        }
33
34        tmphost = string_replace("http://", "", tmplink, 0);
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//      free(path), path = NULL;
46
47        tmpstr = gethttps(link, NULL, NULL, NULL, NULL, NULL, 1);
48        titheklog(debuglevel, "/tmp/vidzi1_get", NULL, NULL, NULL, tmpstr);     
49        url = string_resub("<IFRAME SRC=\"", "\"", tmpstr, 0);
50
51        tmpstr = gethttps(url, NULL, NULL, NULL, NULL, NULL, 1);
52        titheklog(debuglevel, "/tmp/vidzi2_get", NULL, NULL, NULL, tmpstr);     
53
54        tmpstr = jsunpack(tmpstr);
55        titheklog(debuglevel, "/tmp/vidzi3_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, "Video is processing now.") != NULL)
70        {
71                textbox(_("Message"), _("Video is processing now. Conversion stage...") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
72                goto end;
73        }
74
75//      streamlink = string_resub("[{l:\"", "\"", tmpstr, 0);           
76        streamlink = oregex(".*(http://.*v.mp4).*", tmpstr);
77
78        titheklog(debuglevel, "/tmp/vidzi4_streamlink", NULL, NULL, NULL, streamlink);
79
80        free(tmpstr); tmpstr = NULL;
81
82end:
83
84        free(error); error = NULL;
85        free(tmphost); tmphost = NULL;
86        free(tmppath); tmppath = NULL;
87        free(tmpstr); tmpstr = NULL;
88        free(send); send = NULL;
89        free(hash), hash = NULL;
90        free(hashlen), hashlen = NULL;
91        free(hashmsg), hashmsg = NULL;
92        free(id), id = NULL;
93        free(fname), fname = NULL;
94        free(ip); ip = NULL;
95
96        return streamlink;
97}
98
99#endif
Note: See TracBrowser for help on using the repository browser.