Changeset 37474


Ignore:
Timestamp:
Mar 26, 2016, 9:20:15 PM (5 years ago)
Author:
obi
Message:

[tithek] fix xvidstage hoster

Location:
titan/plugins/tithek
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • titan/plugins/tithek/vidag.h

    r37471 r37474  
    4848
    4949        tmpstr = jsunpack(tmpstr);
    50         titheklog(debuglevel, "/tmp/vidag3_get_jsunpack", NULL, NULL, NULL, tmpstr);   
     50        titheklog(debuglevel, "/tmp/vidag2_get_jsunpack", NULL, NULL, NULL, tmpstr);   
    5151
    5252        if(tmpstr == NULL)
     
    7171        streamlink = oregex(".*(http://.*v.mp4).*", tmpstr);
    7272
    73         titheklog(debuglevel, "/tmp/vidag4_streamlink", NULL, NULL, NULL, streamlink);
     73        titheklog(debuglevel, "/tmp/vidag3_streamlink", NULL, NULL, NULL, streamlink);
    7474
    7575        free(tmpstr); tmpstr = NULL;
  • titan/plugins/tithek/vidzi.h

    r37468 r37474  
    1111
    1212        unlink("/tmp/vidzi1_get");
    13         unlink("/tmp/vidzi2_get_jsunpack");
    14         unlink("/tmp/vidzi3_streamlink");
     13        unlink("/tmp/vidzi2_get");
     14        unlink("/tmp/vidzi3_get_jsunpack");
     15        unlink("/tmp/vidzi4_streamlink");
    1516/////////////
    1617        char* tmplink = NULL, *pos = NULL, *path = NULL;
  • titan/plugins/tithek/xvidstage.h

    r28962 r37474  
    66        debug(99, "link: %s", link);
    77        int debuglevel = getconfigint("debuglevel", NULL);
    8         char* tmphost = NULL;
    9         char* tmppath = NULL;
    10         char* tmpstr = NULL;
    11         char* send = NULL;
    12         char* ip = NULL;
    13         char* streamlink = NULL;
    14 
    15         char* cookie = NULL;           
    16         char* id = NULL;
    17         char* fname = NULL;
    18         char* op = NULL;
    19         char* hash = NULL;
    20         char* hashline = NULL;
    21         char* hashlen = NULL;
    22         char* referer = NULL;
    23         char* usr_login = NULL;
    24         char* imhuman = NULL;
    25         char* post = NULL;
    26 
    27         char* b36code = NULL;
    28         char* base = NULL;
    29         char* search = NULL;
    30 
    31         char* tmpstr2 = NULL;
    32         char* tmpstr3 = NULL;
    33         char* charlist = NULL;
    34 
    35         unlink("/tmp/xvidstage1_get");
    36         unlink("/tmp/xvidstage2_post");
     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;
    379
    3810        if(link == NULL) return NULL;
    3911
     12        unlink("/tmp/xvidstage1_get");
     13        unlink("/tmp/xvidstage2_get_jsunpack");
     14        unlink("/tmp/xvidstage3_streamlink");
    4015/////////////
    4116        char* tmplink = NULL, *pos = NULL, *path = NULL;
     
    4823                debug(99, "remove out string: %s", tmplink);
    4924        }
    50        
     25
    5126
    5227        if(tmplink == NULL || ostrncmp("http://", tmplink, 7))
     
    6742        }
    6843
    69         tmppath = ostrcat("/", path, 0, 0);
     44        url = ostrcat(tmphost, "/embed-", 0, 0);
     45        url = ostrcat(url, path, 1, 0);
     46        url = ostrcat(url, ".html", 1, 0);
     47
    7048//      free(path), path = NULL;
    7149
    72 /////////////
     50        tmpstr = gethttps(url, NULL, NULL, NULL, NULL, NULL, 1);
     51        titheklog(debuglevel, "/tmp/xvidstage1_get", NULL, NULL, NULL, tmpstr);
    7352
    74 
    75 /*
    76 //      tmphost = ostrcat("www.", host, 0, 0);
    77         tmphost = ostrcat(host, NULL, 0, 0);
    78         tmppath = ostrcat("/", file, 0, 0);
    79         debug(99, "tmphost: %s", tmphost);
    80         ip = get_ip(tmphost);
    81         debug(99, "tmphost: %s", tmphost);
    82         debug(99, "tmppath: %s", tmppath);
    83         debug(99, "ip: %s", ip);
    84 */
    85         send = ostrcat(send, "GET ", 1, 0);
    86         send = ostrcat(send, tmppath, 1, 0);
    87         send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);     
    88         send = ostrcat(send, tmphost, 1, 0);
    89         send = ostrcat(send, "\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", 1, 0);       
    90         debug(99, "send: %s", send);
    91 
    92         tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
    93         debug(99, "tmpstr: %s", tmpstr);
    94         titheklog(debuglevel, "/tmp/xvidstage1_get", NULL, NULL, NULL, tmpstr);
    95 
    96         free(send); send = NULL;
     53        tmpstr = jsunpack(tmpstr);
     54        titheklog(debuglevel, "/tmp/xvidstage2_get_jsunpack", NULL, NULL, NULL, tmpstr);       
    9755
    9856        if(tmpstr == NULL)
     
    10260        }
    10361
    104         cookie = string_resub("Set-Cookie: afc=", ";", tmpstr, 0);     
    105         debug(99, "cookie: %s", cookie);
    106 
    107         //get hash from tmpstr
    108         char* pos1 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"fname\" value=");
    109         fname = getxmlentry(pos1, "value=");
    110         debug(99, "fname: %s", fname);
    111         if(fname == NULL) goto end;
    112 
    113         char* pos2 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"id\" value=");
    114         id = getxmlentry(pos2, "value=");
    115         debug(99, "id: %s", id);
    116         if(id == NULL) goto end;
    117 
    118         char* pos3 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"op\" value=");
    119         op = getxmlentry(pos3, "value=");
    120         debug(99, "op: %s", op);
    121 
    122         char* pos4 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"rand\" value=");
    123         hashline = getxmlentry(pos4, "value=");
    124         debug(99, "hashline: %s", hashline);
    125 
    126         char* pos5 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"referer\" value=");
    127         referer = getxmlentry(pos5, "value=");
    128         debug(99, "referer: %s", referer);
    129 
    130         char* pos6 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"imhuman\" value=");
    131         imhuman = getxmlentry(pos6, "value=");
    132         debug(99, "imhuman: %s", imhuman);
    133 
    134         char* pos7 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"usr_login\" value=");
    135         usr_login = getxmlentry(pos7, "value=");
    136         debug(99, "usr_login: %s", usr_login);
    137        
    138         free(tmpstr); tmpstr = NULL;
    139         if(op == NULL) goto end;
    140 
    141         hash = ostrcat(hash, "hash=", 1, 0);
    142         hash = ostrcat(hash, hashline, 1, 0);
    143         hash = ostrcat(hash, "&imhuman=Proceed+to+video%22+id%3D%22btn_download&k=Search...%22+size%3D16+onfocus%3D%22%24%28this%29.val%28%27%27%29.css%28%27color%27%2C%27%23333%27%29%3B%22+onblur%3D%22if%28%24%28this%29.val%28%29%3D%3D%27%27%29%24%28this%29.val%28%27Search...%27%29.css%28%27color%27%2C%27%27%29%22+id%3D%22search_top", 1, 0);
    144         hash = ostrcat(hash, "&usr_login=", 1, 0);     
    145         hash = ostrcat(hash, usr_login, 1, 0);
    146         hash = ostrcat(hash, "&referer=", 1, 0);
    147         hash = ostrcat(hash, referer, 1, 0);
    148         hash = ostrcat(hash, "&fname=", 1, 0);
    149         hash = ostrcat(hash, fname, 1, 0);
    150         hash = ostrcat(hash, "&id=", 1, 0);     
    151         hash = ostrcat(hash, id, 1, 0);
    152         hash = ostrcat(hash, "&op=download1", 1, 0);
    153         hash = ostrcat(hash, op, 1, 0);
    154         debug(99, "hash: %s", hash);
    155         hashlen = oitoa(strlen(hash));
    156 
    157         send = ostrcat(send, "POST ", 1, 0);
    158         send = ostrcat(send, tmppath, 1, 0);
    159         send = ostrcat(send, " HTTP/1.1\r\nContent-Length: ", 1, 0);
    160         send = ostrcat(send, hashlen, 1, 0);
    161         send = ostrcat(send, "\r\nAccept-Encoding: gzip\r\nConnection: close\r\nUser-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.99 Safari/535.1\r\nHost: ", 1, 0);
    162         send = ostrcat(send, tmphost, 1, 0);
    163         send = ostrcat(send, "\r\nCookie: afc=", 1, 0);
    164         send = ostrcat(send, cookie, 1, 0);
    165         send = ostrcat(send, "\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n", 1, 0);
    166         send = ostrcat(send, hash, 1, 0);
    167         debug(99, "send: %s", send);
    168 
    169         //send and receive answer
    170         post = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
    171         debug(99, "post: %s", post);
    172         titheklog(debuglevel, "/tmp/xvidstage2_post", NULL, NULL, NULL, post);
    173 
    174 // hier wird nun ein captcha bild auth verlangt geht also erstmal nicht mehr
    175         if(tmpstr == NULL)
     62        if(ostrstr(tmpstr, "404 Not Found") != NULL)
    17663        {
    177                 textbox(_("Message"), _("The page is temporarily unavailable") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
     64                textbox(_("Message"), _("The video no longer exists") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
    17865                goto end;
    17966        }
    180        
    181         tmpstr = string_resub(";return p}('", ");'", post, 0);
    182         titheklog(debuglevel, "/tmp/xvidstage3_tmpstr", NULL, NULL, NULL, tmpstr);
    183        
    184         post = string_replace_all(tmpstr, "", post, 1);
    185         post = string_replace_all(";return p}(');'", "", post, 1);
    186         titheklog(debuglevel, "/tmp/xvidstage4_tmpstr", NULL, NULL, NULL, post);
    18767
    188         free(tmpstr),tmpstr = NULL;
    189         free(b36code),b36code = NULL;
    190         tmpstr = string_resub(";return p}('", ");'", post, 0);
    191         titheklog(debuglevel, "/tmp/xvidstage5_tmpstr", NULL, NULL, NULL, tmpstr);
     68        if(ostrstr(tmpstr, "Video is processing now.") != NULL)
     69        {
     70                textbox(_("Message"), _("Video is processing now. Conversion stage...") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
     71                goto end;
     72        }
    19273
    193         b36code = oregex(".*;',[0-9]{2,2},[0-9]{2,2},'(.*)'.split.*", post);
    194        
    195         b36code = string_replace_all("||", "| |", b36code, 1);
    196         titheklog(debuglevel, "/tmp/xvidstage6_tmpstr", NULL, NULL, NULL, b36code);
    197        
    198         struct splitstr* ret1 = NULL;
    199         int count = 0;
    200         int i = 0;
    201         ret1 = strsplit(b36code, "|", &count);
     74//      streamlink = string_resub("[{l:\"", "\"", tmpstr, 0);           
     75        streamlink = oregex(".*(http://.*video.mkv).*", tmpstr);
    20276
    203         charlist = ostrcat(charlist, "\"", 1, 0);
    204         charlist = ostrcat(charlist, "|", 1, 0);
    205         charlist = ostrcat(charlist, "'", 1, 0);
    206         charlist = ostrcat(charlist, "|", 1, 0);
    207         charlist = ostrcat(charlist, ".", 1, 0);
    208         charlist = ostrcat(charlist, "|", 1, 0);
    209         charlist = ostrcat(charlist, ";", 1, 0);
    210         charlist = ostrcat(charlist, "|", 1, 0);
    211         charlist = ostrcat(charlist, ":", 1, 0);
    212         charlist = ostrcat(charlist, "|", 1, 0);
    213         charlist = ostrcat(charlist, "=", 1, 0);
    214         charlist = ostrcat(charlist, "|", 1, 0);
    215         charlist = ostrcat(charlist, ",", 1, 0);
    216         charlist = ostrcat(charlist, "|", 1, 0);
    217         charlist = ostrcat(charlist, " ", 1, 0);
    218         charlist = ostrcat(charlist, "|", 1, 0);
    219         charlist = ostrcat(charlist, "\\", 1, 0);
    220         charlist = ostrcat(charlist, "|", 1, 0);
    221         charlist = ostrcat(charlist, "/", 1, 0);
    222         charlist = ostrcat(charlist, "|", 1, 0);
    223         charlist = ostrcat(charlist, "(", 1, 0);
    224         charlist = ostrcat(charlist, "|", 1, 0);
    225         charlist = ostrcat(charlist, ")", 1, 0);
    226 
    227         for(i = 0; i < count; i++)
    228         {
    229                 if(ostrstr((&ret1[i])->part, " ") != NULL)
    230                 {
    231                         printf("continue\n");
    232                         continue;
    233                 }
    234                 char* x = oltostr(i, 36);
    235 
    236                 struct splitstr* ret2 = NULL;
    237                 int count2 = 0;
    238                 int i2 = 0;
    239                 tmpstr2 = ostrcat(charlist, NULL, 0, 0);
    240                 ret2 = strsplit(tmpstr2, "|", &count2);
    241                 for(i2 = 0; i2 < count2; i2++)
    242                 {
    243                         struct splitstr* ret3 = NULL;
    244                         int count3 = 0;
    245                         int i3 = 0;
    246                         tmpstr3 = ostrcat(charlist, NULL, 0, 0);
    247                         ret3 = strsplit(tmpstr3, "|", &count3);
    248                         for(i3 = 0; i3 < count3; i3++)
    249                         {
    250                                 debug(99, "-----------------------------------------------");
    251                                 debug(99, "replace %s%s%s <> %s%s%s",(&ret2[i2])->part, x, (&ret3[i3])->part, (&ret2[i2])->part, (&ret1[i])->part, (&ret3[i3])->part);
    252 
    253                                 base = ostrcat(base, (&ret2[i2])->part, 1, 0);
    254                                 base = ostrcat(base, x, 1, 0);
    255                                 base = ostrcat(base, (&ret3[i3])->part, 1, 0);         
    256                                 search = ostrcat(search, (&ret2[i2])->part, 1, 0);
    257                                 search = ostrcat(search, (&ret1[i])->part, 1, 0);
    258                                 search = ostrcat(search, (&ret3[i3])->part, 1, 0);
    259                                 tmpstr = string_replace_all(base, search, tmpstr, 1);
    260                                 free(base), base = NULL;
    261                                 free(search), search = NULL;
    262                         }
    263                         free(ret3), ret3 = NULL;
    264                         free(tmpstr3), tmpstr3 = NULL;
    265                 }
    266                 free(ret2), ret2 = NULL;
    267                 free(tmpstr2), tmpstr2 = NULL;
    268                 free(x);
    269         }
    270         free(ret1), ret1 = NULL;
    271         free(b36code), b36code = NULL;
    272         free(post), post = NULL;
    273         free(charlist), charlist = NULL;
    274 
    275         titheklog(debuglevel, "/tmp/xvidstage7_tmpstr_last", NULL, NULL, NULL, tmpstr);
    276 
    277         streamlink = oregex(".*file.*(http:.*video.flv).*image.*", tmpstr);
    278         if(streamlink == NULL)
    279                 streamlink = oregex(".*file.*(http:.*video.mp4).*image.*", tmpstr);                             
    280 
    281         if(streamlink == NULL)
    282                 streamlink = oregex(".*file.*(http:.*video.mkv).*image.*", tmpstr);
    283 
    284         if(streamlink == NULL)
    285                 streamlink = oregex(".*file.*(http:.*video.avi).*image.*", tmpstr);
    286 
    287         if(streamlink == NULL)
    288                 streamlink = oregex(".*src=.*(http:.*video.mp4).*\".*", tmpstr);
    289 
    290         if(streamlink == NULL)
    291                 streamlink = oregex(".*src=.*(http:.*video.mkv).*\".*", tmpstr);
    292 
    293         if(streamlink == NULL)
    294                 streamlink = oregex(".*src=.*(http:.*video.avi).*\".*", tmpstr);
    295                
    296         if(streamlink == NULL)
    297                 streamlink = oregex(".*value=.*(http:.*video.mp4).*\".*", tmpstr);                             
    298 
    299         if(streamlink == NULL)
    300                 streamlink = oregex(".*value=.*(http:.*video.mkv).*\".*", tmpstr);
    301 
    302         if(streamlink == NULL)
    303                 streamlink = oregex(".*value=.*(http:.*video.avi).*\".*", tmpstr);                     
    304 
    305         titheklog(debuglevel, "/tmp/xvidstage8_streamlink", NULL, NULL, NULL, streamlink);
     77        titheklog(debuglevel, "/tmp/xvidstage3_streamlink", NULL, NULL, NULL, streamlink);
    30678
    30779        free(tmpstr); tmpstr = NULL;
     
    30981end:
    31082
    311         free(cookie); cookie = NULL;
    312         free(hash), hash = NULL;
    313         free(hashlen), hashlen = NULL;
    314         free(op), op = NULL;
    315         free(id), id = NULL;
    316         free(fname), fname = NULL;
    317                
     83        free(error); error = NULL;
    31884        free(tmphost); tmphost = NULL;
    31985        free(tmppath); tmppath = NULL;
    32086        free(tmpstr); tmpstr = NULL;
    32187        free(send); send = NULL;
     88        free(hash), hash = NULL;
     89        free(hashlen), hashlen = NULL;
     90        free(hashmsg), hashmsg = NULL;
     91        free(id), id = NULL;
     92        free(fname), fname = NULL;
    32293        free(ip); ip = NULL;
    32394
Note: See TracChangeset for help on using the changeset viewer.