source: titan/plugins/tithek/thevideo.h @ 38266

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

fix thevideo change

File size: 7.3 KB
Line 
1#ifndef THEVIDEO_H
2#define THEVIDEO_H
3
4char* thevideo(char* link)
5{
6        debug(99, "link: %s", link);
7        int debuglevel = getconfigint("debuglevel", NULL);
8        char* tmphost = NULL, *tmplink = NULL, *tmppath = NULL, *tmpstr = NULL, *streamlink = NULL, *pos = NULL, *path = NULL, *url = NULL;
9        char* vhash = NULL, *gfk = NULL, *fname = NULL, *hash = NULL, *post = NULL, *inhu = NULL, *op = NULL, *vt = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL, *tmpstr3 = NULL;
10
11        if(link == NULL) return NULL;
12
13        unlink("/var/usr/local/share/titan/plugins/tithek/thevideo1_get");
14        unlink("/var/usr/local/share/titan/plugins/tithek/thevideo2_post");
15
16        unlink("/tmp/thevideo2_streamlink");
17/////////////
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        if(tmplink == NULL || ostrncmp("http://", tmplink, 7))
28        {
29                textbox(_("Message"), _("Hoster Url not http://") , _("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        free(tmplink) , tmplink = NULL;
35
36        if(tmphost != NULL)
37                pos = strchr(tmphost, '/');
38        if(pos != NULL)
39        {
40                pos[0] = '\0';
41                path = pos + 1;
42        }
43
44        tmppath = ostrcat("/embed-", path, 0, 0);
45        tmppath = ostrcat(tmppath, ".html", 1, 0);
46
47//      tmppath = ostrcat("/", path, 0, 0);
48
49/*
50http://thevideo.me/g5oi83o7260u
51'GET /embed-g5oi83o7260u.html HTTP/1.1\r\nHost: thevideo.me\r\nUser-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.99 Safari/535.1\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n'
52'GET /ikjtbmjr5woammfvg77fchotfr76hz35ahh6bglfezhodqxskyt544voxnpq/v.mp4 HTTP/1.1\r\nAccept-Encoding: identity\r\nHost: d2171.thevideo.me:8777\r\nCookie: __cfduid=de1d2f326ba9713a1f3a8497c518c5ee01441986583\r\nConnection: close\r\nUser-Agent: Python-urllib/2.7\r\n\r\n'
53http://d2171.thevideo.me:8777/ikjtbmjr5woammfvg77fchotfr76hz35ahh6bglfezhodqxskyt544voxnpq/v.mp4
54http://d2171.thevideo.me:8777/ikjtbmjr5woammfvg77fchotfr76hz35ahh6bglfezhodqxskyt544voxnpq/v.mp4|User-Agent=Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3 -> application/octet-stream
55*/
56        debug(99, "tmppath: %s", tmppath);
57        debug(99, "tmphost: %s", tmphost);
58        url = ostrcat(tmphost, tmppath, 0, 0);
59        debug(99, "url: %s", url);
60        tmpstr = gethttps(link, NULL, NULL, NULL, NULL, NULL, 1);
61        titheklog(debuglevel, "/var/usr/local/share/titan/plugins/tithek/thevideo1_get", NULL, NULL, NULL, tmpstr);     
62
63        if(tmpstr == NULL)
64        {
65                textbox(_("Message"), _("The page is temporarily unavailable") , _("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, "404 Not Found") != 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        vhash = string_resub("'_vhash', value: '", "'", tmpstr, 0);
76        gfk = string_resub("'gfk', value: '", "'", tmpstr, 0);
77        fname = string_resub("name=\"fname\" value=\"", "\"", tmpstr, 0);
78        hash = string_resub("name=\"hash\" value=\"", "\"", tmpstr, 0);
79        op = string_resub("name=\"op\" value=\"", "\"", tmpstr, 0);
80        inhu = string_resub("name=\"inhu\" value=\"", "\"", tmpstr, 0);
81        free(tmpstr); tmpstr = NULL;
82
83        post = ostrcat("_vhash=", vhash, 0, 0);
84        post = ostrcat(post, "&gfk=", 1, 0);
85        post = ostrcat(post, gfk, 1, 0);
86        post = ostrcat(post, "&op=", 1, 0);
87        post = ostrcat(post, op, 1, 0);
88        post = ostrcat(post, "&usr_login=&id=", 1, 0);
89        post = ostrcat(post, path, 1, 0);
90        post = ostrcat(post, "&fname=", 1, 0);
91        post = ostrcat(post, fname, 1, 0);
92        post = ostrcat(post, "&referer=http%3A%2F%2Fthevideo.me%2F", 1, 0);
93        post = ostrcat(post, path, 1, 0);
94        post = ostrcat(post, "&hash=", 1, 0);
95        post = ostrcat(post, hash, 1, 0);
96        post = ostrcat(post, "&inhu=", 1, 0);
97        post = ostrcat(post, inhu, 1, 0);
98        post = ostrcat(post, "&imhuman=", 1, 0);
99
100        debug(99, "post: %s", post);
101
102        debug(99, "url: %s", url);
103        tmpstr = gethttps(link, NULL, post, NULL, NULL, link, 1);
104        titheklog(debuglevel, "/var/usr/local/share/titan/plugins/tithek/thevideo2_post", NULL, NULL, NULL, tmpstr);   
105
106        streamlink = string_resub("'label' : '360p', 'file' : '", "'", tmpstr, 0);
107        if(streamlink == NULL)
108                streamlink = string_resub("'label' : '240p', 'file' : '", "'", tmpstr, 0);             
109        if(streamlink == NULL)
110                streamlink = string_resub("label: '240p', file: '", "'", tmpstr, 0);           
111        if(streamlink == NULL)
112                streamlink = string_resub("label: '360p', file: '", "'", tmpstr, 0);           
113        if(streamlink == NULL)
114                streamlink = oregex(".*(http://.*v.mp4).*", tmpstr);
115
116        tmpstr1 = string_resub("<div class=\"container main-container\">", "</div>", tmpstr, 0);
117        free(tmpstr), tmpstr = NULL;
118        debug(99, "tmpstr1: %s", tmpstr1);
119        url = string_resub("<script src=\"", "\"></script>", tmpstr1, 0);
120
121        if(url == NULL)
122        {
123                tmpstr2 = string_resub("' + '", "'.concat", tmpstr1, 0);
124                tmpstr3 = string_resub("var tksucks='", "';", tmpstr1, 0);
125                url = ostrcat("http://thevideo.me", tmpstr2, 0, 0);
126                url = ostrcat(url, "/", 1, 0);
127                url = ostrcat(url, tmpstr3, 1, 0);
128                free(tmpstr2), tmpstr2 = NULL;
129                free(tmpstr3), tmpstr3 = NULL;
130        }
131        free(tmpstr1), tmpstr1 = NULL;
132       
133/*
134        <script src="https://thevideo.me/jwjsv/sfqlqb288ft2"></script>
135        https://thevideo.me/jwjsv/sfqlqb288ft2
136
137
138        var tksucks='LDw2JVcsJyVSPEchUz4zMUcK';document.write('<script s'.concat( 'rc="' + '/jwv'.concat( '/'+tksucks+'">\x3C/script>' ) ) )
139        http://thevideo.me/jwv/LDlHJFE+RihWPEMtUz5DKUM
140*/
141
142        tmpstr = gethttps(url, NULL, NULL, NULL, NULL, link, 1);
143        titheklog(debuglevel, "/var/usr/local/share/titan/plugins/tithek/thevideo3_get", NULL, NULL, NULL, tmpstr);     
144
145        tmpstr1 = string_resub("[],30,'", "'.split('|')", tmpstr, 0);
146        int count = 0;
147        int j;
148        struct splitstr* ret1 = NULL;
149        ret1 = strsplit(tmpstr1, "|", &count);
150
151        if(ret1 != NULL && count > 0)
152        {
153                for(j = 0; j < count; j++)
154                {
155                        if(strlen(ret1[j].part) > 50)
156                                vt = ostrcat(ret1[j].part, NULL, 0, 0);
157                }
158        }
159        free(ret1); ret1 = NULL;
160
161/*
162        https://d4242.thevideo.me:8777/gwjta3agywoammfvg7sfgcmaglluse7vcwc6gn6frivojkuv2dk6h7fk77bpqtu5v6uxlvg6okwz2hdqdykueqnd5hllm5bnwwveiqijxa5b6wzozls26gn3f7ci6pvr44jhdqjt3ndyur5ecocf2pz4mlwtmdzps4xtk7jdce3ezweuna7ww2u4pmujltietcuedpvveh4tc6sjv3oxljsajrq5hz22vtwthssqknhd3v5psrp2rur2gxroejzewfek5dbr/v.mp4?direct=false&ua=1&vt=osv3jha2zaetuu35h7nm4hpodzb7raf5clkelbe2gmgew3qcowp257vjk347pb6fshhj3uku2vggcte3ix4tqwp6gy5twendw4wrkj76ms437ghk76hhb5iimrpmjgt4uee4hdhctjvy72pfx7us3usbvyiwxpizl5mbo2alkrb4g253pznnrqn5ub4a7w36p3lirdnfoxogogs7pnsspgmxi6wqinys7orguna
163*/
164
165        if(streamlink != NULL)
166        {
167                streamlink = ostrcat(streamlink, "?direct=false&ua=1&vt=", 1, 0);
168                if(vt != NULL)
169                        streamlink = ostrcat(streamlink, vt, 1, 0);
170                else
171                        streamlink = ostrcat(streamlink, "1", 1, 0);
172        }
173
174        titheklog(debuglevel, "/tmp/thevideo1_streamlink", NULL, NULL, NULL, streamlink);
175
176end:
177
178        free(vhash); vhash = NULL;
179        free(gfk); gfk = NULL;
180        free(fname); fname = NULL;
181        free(hash); hash = NULL;
182        free(post); post = NULL;
183        free(inhu); inhu = NULL;
184        free(op); op = NULL;
185        free(vt); vt = NULL;
186        free(url); url = NULL;
187        free(tmphost); tmphost = NULL;
188        free(tmppath); tmppath = NULL;
189        free(tmplink); tmplink = NULL;
190        free(tmpstr); tmpstr = NULL;
191        free(tmpstr1); tmpstr1 = NULL;
192
193        return streamlink;
194}
195
196#endif
Note: See TracBrowser for help on using the repository browser.