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

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

next

File size: 10.2 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("/tmp/thevideo1_get");
14        unlink("/tmp/thevideo2_post");
15        unlink("/tmp/thevideo3_get");
16        unlink("/tmp/thevideo4_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, 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        tmppath = ostrcat("/embed-", path, 0, 0);
46        tmppath = ostrcat(tmppath, ".html", 1, 0);
47
48//      tmppath = ostrcat("/", path, 0, 0);
49
50/*
51http://thevideo.me/g5oi83o7260u
52'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'
53'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'
54http://d2171.thevideo.me:8777/ikjtbmjr5woammfvg77fchotfr76hz35ahh6bglfezhodqxskyt544voxnpq/v.mp4
55http://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
56*/
57        debug(99, "tmppath: %s", tmppath);
58        debug(99, "tmphost: %s", tmphost);
59        url = ostrcat(tmphost, tmppath, 0, 0);
60        debug(99, "url: %s", url);
61        tmpstr = gethttps(link, NULL, NULL, NULL, NULL, NULL, 1);
62        titheklog(debuglevel, "/tmp/thevideo1_get", NULL, NULL, NULL, tmpstr); 
63
64        if(tmpstr == NULL)
65        {
66                textbox(_("Message"), _("The page is temporarily unavailable") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
67                goto end;
68        }
69
70        if(ostrstr(tmpstr, "404 Not Found") != NULL)
71        {
72                textbox(_("Message"), _("The video no longer exists") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
73                goto end;
74        }
75
76        vhash = string_resub("'_vhash', value: '", "'", tmpstr, 0);
77        gfk = string_resub("'gfk', value: '", "'", tmpstr, 0);
78        fname = string_resub("name=\"fname\" value=\"", "\"", tmpstr, 0);
79        hash = string_resub("name=\"hash\" value=\"", "\"", tmpstr, 0);
80        op = string_resub("name=\"op\" value=\"", "\"", tmpstr, 0);
81        inhu = string_resub("name=\"inhu\" value=\"", "\"", tmpstr, 0);
82        free(tmpstr); tmpstr = NULL;
83
84        post = ostrcat("_vhash=", vhash, 0, 0);
85        post = ostrcat(post, "&gfk=", 1, 0);
86        post = ostrcat(post, gfk, 1, 0);
87        post = ostrcat(post, "&op=", 1, 0);
88        post = ostrcat(post, op, 1, 0);
89        post = ostrcat(post, "&usr_login=&id=", 1, 0);
90        post = ostrcat(post, path, 1, 0);
91        post = ostrcat(post, "&fname=", 1, 0);
92        post = ostrcat(post, fname, 1, 0);
93        post = ostrcat(post, "&referer=http%3A%2F%2Fthevideo.me%2F", 1, 0);
94        post = ostrcat(post, path, 1, 0);
95        post = ostrcat(post, "&hash=", 1, 0);
96        post = ostrcat(post, hash, 1, 0);
97        post = ostrcat(post, "&inhu=", 1, 0);
98        post = ostrcat(post, inhu, 1, 0);
99        post = ostrcat(post, "&imhuman=", 1, 0);
100
101        debug(99, "post: %s", post);
102
103        debug(99, "url: %s", url);
104        tmpstr = gethttps(link, NULL, post, NULL, NULL, link, 1);
105        titheklog(debuglevel, "/tmp/thevideo2_post", NULL, NULL, NULL, tmpstr);
106
107        streamlink = string_resub("'label' : '360p', 'file' : '", "'", tmpstr, 0);
108        titheklog(debuglevel, "/tmp/thevideo2_post_streamlink1", NULL, NULL, NULL, streamlink);
109
110        if(streamlink == NULL)
111                streamlink = string_resub("'label' : '240p', 'file' : '", "'", tmpstr, 0);             
112        titheklog(debuglevel, "/tmp/thevideo2_post_streamlink2", NULL, NULL, NULL, streamlink);
113
114        if(streamlink == NULL)
115                streamlink = string_resub("label: '240p', file: '", "'", tmpstr, 0);           
116        titheklog(debuglevel, "/tmp/thevideo2_post_streamlink3", NULL, NULL, NULL, streamlink);
117
118        if(streamlink == NULL)
119                streamlink = string_resub("label: '360p', file: '", "'", tmpstr, 0);
120        titheklog(debuglevel, "/tmp/thevideo2_post_streamlink4", NULL, NULL, NULL, streamlink);
121
122
123//  sources: [{"file":"https://d3861.thevideo.me:8777/kgjtaznnpgoammfvg54fmh4ihf6iyptt3axejg7zooshqaa3rl72oia2ejcvbrt3zezduyuhrnsu4yyrb72hjkhujsdhg4rasehxwt7whmlzyd6wf64y5r47h2ejyzqv454juyd5yfxocddcstfngy67yio7zymsqvnlljjjyybcjt4xzduxi6dpzsa24ioimmsajr27mzxgbdqvtz76rbms3txhjitcquabsj5mbnfryf5a362fxqlo5awjzdieb5uypjhvcg53rjuvc7ei2pm4oipa/v.mp4","label":"240p"}],
124
125        if(streamlink == NULL)         
126                streamlink = oregex(".*sources:.*\"file\":\"(http.*v.mp4).*", tmpstr);
127//              streamlink = oregex(".*sources: [{"file":"(http://.*v.mp4).*", tmpstr);
128        titheklog(debuglevel, "/tmp/thevideo2_post_streamlink5", NULL, NULL, NULL, streamlink);
129
130        if(streamlink == NULL)
131                streamlink = oregex(".*(http://.*v.mp4).*", tmpstr);
132        titheklog(debuglevel, "/tmp/thevideo2_post_streamlink6", NULL, NULL, NULL, streamlink);
133
134//      var mpri_Key='LCw2QFU8N0hRPFdBWi4zLVgK';
135//      eval(function(p,a,c,k,e,d){e=function(c){return c};if(!''.replace(/^/,String)){while(c--){d[c]=k[c]||c}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('3.2(\'<0 4\'.1(\'8="\'+\'/5\'.1(\'/\'+7+\'">\\6/0>\')))',9,9,'script|concat|write|document|s|jwv|x3C|mpri_Key|rc'.split('|'),0,{}))
136        tmpstr = jsunpack(tmpstr);
137        titheklog(debuglevel, "/tmp/thevideo3_post_jsunpack", NULL, NULL, NULL, tmpstr);       
138
139        tmpstr1 = string_resub("<div class=\"container main-container\">", "</div>", tmpstr, 0);
140        free(tmpstr), tmpstr = NULL;
141        debug(99, "tmpstr1: %s", tmpstr1);
142        url = string_resub("<script src=\"", "\"></script>", tmpstr1, 0);
143
144        if(url == NULL)
145        {
146                tmpstr2 = string_resub("+\\'", "\\'.concat", tmpstr1, 0);
147//              tmpstr3 = string_resub("var tksucks='", "';", tmpstr1, 0);
148                tmpstr3 = oregex("var .*='(.*)';.*", tmpstr1);
149
150                url = ostrcat("http://thevideo.me", tmpstr2, 0, 0);
151                url = ostrcat(url, "/", 1, 0);
152                url = ostrcat(url, tmpstr3, 1, 0);
153                free(tmpstr2), tmpstr2 = NULL;
154                free(tmpstr3), tmpstr3 = NULL;
155        }
156
157/*
158//old
159        if(url == NULL)
160        {
161                tmpstr2 = string_resub(",9,9,'", "'.split", tmpstr1, 0);
162       
163                int count = 0;
164                int j;
165                struct splitstr* ret1 = NULL;
166                ret1 = strsplit(tmpstr2, "|", &count);
167                if(ret1 != NULL && count > 0)
168                {
169                        for(j = 0; j < count; j++)
170                        {
171                                if(ostrcmp(ret1[j].part, "script") != 0 && ostrcmp(ret1[j].part, "concat") != 0 && ostrcmp(ret1[j].part, "write") != 0 && ostrcmp(ret1[j].part, "document") != 0 && ostrcmp(ret1[j].part, "s") != 0 && ostrcmp(ret1[j].part, "x3C") != 0 && ostrcmp(ret1[j].part, "mpri_Key") != 0 && ostrcmp(ret1[j].part, "rc") != 0)
172                                        tmpstr3 = ostrcat("/", ret1[j].part, 0, 0);
173                        }
174                }
175                free(ret1); ret1 = NULL;
176        //  script|concat|write|document|s|jwv|x3C|mpri_Key|rc
177
178                tmpstr4 = oregex("var .*='(.*)';.*", tmpstr1);
179
180                url = ostrcat("http://thevideo.me", tmpstr3, 0, 0);
181                url = ostrcat(url, "/", 1, 0);
182                url = ostrcat(url, tmpstr4, 1, 0);
183                free(tmpstr2), tmpstr2 = NULL;
184                free(tmpstr3), tmpstr3 = NULL;
185                free(tmpstr4), tmpstr4 = NULL;
186        }
187
188// old 
189        if(url == NULL)
190        {
191                tmpstr2 = string_resub("' + '", "'.concat", tmpstr1, 0);
192//              tmpstr3 = string_resub("var tksucks='", "';", tmpstr1, 0);
193                tmpstr3 = oregex("var .*='(.*)';.*", tmpstr1);
194
195                url = ostrcat("http://thevideo.me", tmpstr2, 0, 0);
196                url = ostrcat(url, "/", 1, 0);
197                url = ostrcat(url, tmpstr3, 1, 0);
198                free(tmpstr2), tmpstr2 = NULL;
199                free(tmpstr3), tmpstr3 = NULL;
200        }
201*/     
202
203        free(tmpstr1), tmpstr1 = NULL;
204       
205/*
206        <script src="https://thevideo.me/jwjsv/sfqlqb288ft2"></script>
207        https://thevideo.me/jwjsv/sfqlqb288ft2
208
209
210        var tksucks='LDw2JVcsJyVSPEchUz4zMUcK';document.write('<script s'.concat( 'rc="' + '/jwv'.concat( '/'+tksucks+'">\x3C/script>' ) ) )
211        http://thevideo.me/jwv/LDlHJFE+RihWPEMtUz5DKUM
212*/
213
214        tmpstr = gethttps(url, NULL, NULL, NULL, NULL, link, 1);
215        titheklog(debuglevel, "/tmp/thevideo3_get", NULL, NULL, NULL, tmpstr); 
216
217        tmpstr1 = string_resub("[],30,'", "'.split('|')", tmpstr, 0);
218        int count = 0;
219        int j;
220        struct splitstr* ret1 = NULL;
221        ret1 = strsplit(tmpstr1, "|", &count);
222
223        if(ret1 != NULL && count > 0)
224        {
225                for(j = 0; j < count; j++)
226                {
227                        if(strlen(ret1[j].part) > 50)
228                                vt = ostrcat(ret1[j].part, NULL, 0, 0);
229                }
230        }
231        free(ret1); ret1 = NULL;
232
233/*
234        https://d4242.thevideo.me:8777/gwjta3agywoammfvg7sfgcmaglluse7vcwc6gn6frivojkuv2dk6h7fk77bpqtu5v6uxlvg6okwz2hdqdykueqnd5hllm5bnwwveiqijxa5b6wzozls26gn3f7ci6pvr44jhdqjt3ndyur5ecocf2pz4mlwtmdzps4xtk7jdce3ezweuna7ww2u4pmujltietcuedpvveh4tc6sjv3oxljsajrq5hz22vtwthssqknhd3v5psrp2rur2gxroejzewfek5dbr/v.mp4?direct=false&ua=1&vt=osv3jha2zaetuu35h7nm4hpodzb7raf5clkelbe2gmgew3qcowp257vjk347pb6fshhj3uku2vggcte3ix4tqwp6gy5twendw4wrkj76ms437ghk76hhb5iimrpmjgt4uee4hdhctjvy72pfx7us3usbvyiwxpizl5mbo2alkrb4g253pznnrqn5ub4a7w36p3lirdnfoxogogs7pnsspgmxi6wqinys7orguna
235*/
236
237        if(streamlink != NULL)
238        {
239                streamlink = ostrcat(streamlink, "?direct=false&ua=1&vt=", 1, 0);
240                if(vt != NULL)
241                        streamlink = ostrcat(streamlink, vt, 1, 0);
242                else
243                        streamlink = ostrcat(streamlink, "1", 1, 0);
244        }
245
246        titheklog(debuglevel, "/tmp/thevideo4_streamlink", NULL, NULL, NULL, streamlink);
247
248end:
249
250        free(vhash); vhash = NULL;
251        free(gfk); gfk = NULL;
252        free(fname); fname = NULL;
253        free(hash); hash = NULL;
254        free(post); post = NULL;
255        free(inhu); inhu = NULL;
256        free(op); op = NULL;
257        free(vt); vt = NULL;
258        free(url); url = NULL;
259        free(tmphost); tmphost = NULL;
260        free(tmppath); tmppath = NULL;
261        free(tmplink); tmplink = NULL;
262        free(tmpstr); tmpstr = NULL;
263        free(tmpstr1); tmpstr1 = NULL;
264
265        return streamlink;
266}
267
268#endif
Note: See TracBrowser for help on using the repository browser.