Changeset 34092


Ignore:
Timestamp:
Apr 21, 2015, 2:24:00 PM (5 years ago)
Author:
obi
Message:

[tithek] fix flashx

File:
1 edited

Legend:

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

    r28962 r34092  
    88        char* tmphost = NULL, *tmppath = NULL, *tmpstr = NULL, *send = NULL, *streamlink = NULL, *ip = NULL;
    99        char* playurl = NULL, *tmpstr2 = NULL, *hash1tmp = NULL, *hash2tmp = NULL, *hash = NULL, *hash1 = NULL, *hash2 = NULL, *error = NULL, *cookie1 = NULL, *cookie2 = NULL, *cookie3 = NULL, *tmphost1 = NULL;
    10 
    11 
    12 /////////////
     10        char* app = NULL, *playpath = NULL, *swfUrl = NULL, *pageUrl = NULL, *swfVfy = NULL;
    1311        char* tmplink = NULL, *pos = NULL, *path = NULL;
    1412
     
    2018                debug(99, "remove out string: %s", tmplink);
    2119        }
    22        
    2320
    2421        if(tmplink == NULL || ostrncmp("http://", tmplink, 7))
     
    3936        }
    4037
    41         tmppath = ostrcat("/", path, 0, 0);
    42 //      free(path), path = NULL;
     38        tmppath = ostrcat("/embed-", path, 0, 0);
     39        tmphost = string_replace("www.", "", tmphost, 0);
    4340
    44 /////////////
    45 
    46 
    47 /*
    48         if(host == NULL || file == NULL) return NULL;
    49 
    50         ip = string_replace("http://", "", (char*)hosterurl, 0);
    51 
    52         if(ip != NULL)
    53                 pos = strchr(ip, '/');
    54         if(pos != NULL)
    55         {
    56                 pos[0] = '\0';
    57                 path = pos + 1;
    58         }
    59        
    60         tmphost = ostrcat(ip, NULL, 0, 0);
    61         tmppath = ostrcat("/", path, 0, 0);
    62 */
    63        
    6441        send = ostrcat(send, "GET ", 1, 0);
    6542        send = ostrcat(send, tmppath, 1, 0);
    6643        send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);     
    6744        send = ostrcat(send, tmphost, 1, 0);
    68         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);       
     45        send = ostrcat(send, "\r\n", 1, 0);     
     46        send = ostrcat(send, "User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.99 Safari/535.1\r\n", 1, 0);     
     47        send = ostrcat(send, "Referer: http://flashx.tv", 1, 0);
     48        send = ostrcat(send, tmppath, 1, 0);
     49        send = ostrcat(send, "\r\n", 1, 0);     
     50        send = ostrcat(send, "Connection: close\r\n", 1, 0);   
     51        send = ostrcat(send, "Accept-Encoding: gzip\r\n\r\n", 1, 0);   
     52
    6953        debug(99, "#############################################################################################################");
    7054        debug(99, "send1: %s", send);
     
    7458        debug(99, "tmpstr: %s", tmpstr);
    7559        titheklog(debuglevel, "/tmp/flashx_tmpstr_get1", NULL, NULL, NULL, tmpstr);
    76  
    77         if(tmpstr == NULL || ostrstr(tmpstr, "<center>Video not found, deleted or abused, sorry!<br") != NULL)
    78         {
    79                 error = string_resub("<li> <center>", "<br", tmpstr, 0);
    80                 string_deltags(error);
    81                 error = strstrip(error);
    82                 if(error == NULL || strlen(error) == 0)
    83                         error = ostrcat(_("The page is temporarily unavailable"), NULL, 0, 0);
    84                 textbox(_("Message"), error, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 400, 0, 0);
    85                 goto end;
    86         }
    87        
    88         cookie1 = string_resub("Set-Cookie: pageredir=", ";", tmpstr, 0);
    89         debug(99, "cookie1 (pageredir): %s", cookie1);
    90 
    91         cookie2 = string_resub("Set-Cookie: PHPSESSID=", ";", tmpstr, 0);
    92         debug(99, "cookie2 (PHPSESSID): %s", cookie2);
    93 
    94         cookie3 = string_resub("Set-Cookie: video_", "=", tmpstr, 0);
    95         debug(99, "cookie3 (vid): %s", cookie3);
    96        
    97         if(cookie3 == NULL)
    98         {
    99                 debug(99, "use url (vid): %s", cookie3);       
    100                 cookie3 = string_resub("http://flashx.tv/video/", "/", tmpstr, 0);
    101         }
    102 
    103         free(tmppath), tmppath = NULL;
    104         tmppath = ostrcat("/player/embed.php?vid=", cookie3, 0, 0);
    105         free(tmphost), tmphost = NULL;
    106         tmphost1 = oregex(".*<iframe width=.*src=\"(http://.*)&width.*", tmpstr);
    107         tmphost = string_resub("http://", "/", tmphost1, 0);
    108         free(tmphost1), tmphost1 = NULL;
    109         free(tmpstr); tmpstr = NULL;
    110         free(send); send = NULL;
    111 
    112         send = ostrcat(send, "GET ", 1, 0);
    113         send = ostrcat(send, tmppath, 1, 0);
    114         send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);     
    115         send = ostrcat(send, tmphost, 1, 0);   
    116         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\n", 1, 0);
    117 
    118         send = ostrcat(send, "Cookie: pageredir=", 1, 0);       
    119         send = ostrcat(send, cookie1, 1, 0);
    120         send = ostrcat(send, "; PHPSESSID=", 1, 0);     
    121         send = ostrcat(send, cookie2, 1, 0);   
    122         send = ostrcat(send, "\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n", 1, 0);   
    123         debug(99, "#############################################################################################################");
    124         debug(99, "send2: %s", send);
    125         debug(99, "#############################################################################################################");
    126 
    127         tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
    128         titheklog(debuglevel, "/tmp/flashx_tmpstr_get2", NULL, NULL, NULL, tmpstr);
    129         debug(99, "tmpstr: %s", tmpstr);
    13060
    13161        if(tmpstr == NULL || ostrstr(tmpstr, "<center>Video not found, deleted or abused, sorry!<br") != NULL)
     
    14070        }
    14171
    142         hash1tmp = string_resub("<input type=\"hidden\" name=\"sec\" value=\"", "\"", tmpstr, 0);
    143         hash2tmp = string_resub("<input type=\"hidden\" name=\"id\" value=\"", "\"", tmpstr, 0);
    144        
    145         if(hash1tmp == NULL || hash2tmp == NULL) goto end;
    146         hash1 = htmlencode(hash1tmp);
    147         hash2 = htmlencode(hash2tmp);
    148         free(hash1tmp); hash1tmp = NULL;
    149         free(hash2tmp); hash2tmp = NULL;
    150        
    151         // htmldecod cant / to %2f
    152         hash1 = string_replace_all("/", "%2F", hash1, 1);
    153         hash2 = string_replace_all("/", "%2F", hash2, 1);
     72//      tmpstr2 = oregex(".*(luq4qk.*)\|.*", tmpstr);
     73        tmpstr2 = string_resub("|luq4", "|", tmpstr, 0);
     74        tmpstr2 = ostrcat("/luq4", tmpstr2, 0, 1);
     75        tmpstr2 = ostrcat(tmpstr2, ".smil", 1, 0);
     76        free(tmpstr), tmpstr = NULL;
     77        free(send), send = NULL;
    15478
    155         hash = ostrcat("sec=", hash1, 0, 0);
    156         hash = ostrcat(hash, "&id=", 0, 0);
    157         hash = ostrcat(hash, hash2, 0, 0);
    158         char* hashlen = NULL;
    159 
    160         if(hash == NULL) goto end;
    161         hashlen = oitoa(strlen(hash));
    162         debug(99, "hashlen: %s", hashlen);
    163         free(tmpstr); tmpstr = NULL;
    164         free(send); send = NULL;
    165 
    166 //      send = ostrcat(send, "POST /player/show.php HTTP/1.1\r\nContent-Length: ", 1, 0);
    167         send = ostrcat(send, "POST /player/playit.php HTTP/1.1\r\nContent-Length: ", 1, 0);
    168         send = ostrcat(send, hashlen, 1, 0);
    169         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);
     79        send = ostrcat(send, "GET ", 1, 0);
     80        send = ostrcat(send, tmpstr2, 1, 0);
     81        send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);     
    17082        send = ostrcat(send, tmphost, 1, 0);
    171         send = ostrcat(send, "\r\nCookie: pageredir=", 1, 0);
    172         send = ostrcat(send, cookie1, 1, 0);
    173         send = ostrcat(send, "; PHPSESSID=", 1, 0);     
    174         send = ostrcat(send, cookie2, 1, 0);
    175         send = ostrcat(send, "\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n", 1, 0);     
    176         send = ostrcat(send, hash, 1, 0);
    177         free(hash); hash = NULL;
    178         free(hashlen); hashlen = NULL;
     83        send = ostrcat(send, "\r\n", 1, 0);     
     84        send = ostrcat(send, "User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.99 Safari/535.1\r\n", 1, 0);     
     85        send = ostrcat(send, "Referer: http://flashx.tv", 1, 0);
     86        send = ostrcat(send, tmppath, 1, 0);
     87        send = ostrcat(send, "\r\n", 1, 0);     
     88        send = ostrcat(send, "Connection: close\r\n", 1, 0);   
     89        send = ostrcat(send, "Accept-Encoding: gzip\r\n\r\n", 1, 0);   
    17990
    18091        debug(99, "#############################################################################################################");
    181         debug(99, "send3: %s", send);
     92        debug(99, "send2: %s", send);
    18293        debug(99, "#############################################################################################################");
    18394
    184         tmpstr = gethttpreal(tmphost, "/player/show.php", 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
     95        tmpstr = gethttpreal(tmphost, tmpstr2, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
    18596        debug(99, "tmpstr: %s", tmpstr);
    186         titheklog(debuglevel, "/tmp/flashx_tmpstr_get3", NULL, NULL, NULL, tmpstr);
     97        titheklog(debuglevel, "/tmp/flashx_tmpstr_get2", NULL, NULL, NULL, tmpstr);
    18798
    188         if(tmpstr == NULL || ostrstr(tmpstr, "<center>Video not found, deleted or abused, sorry!<br") != NULL)
    189         {
    190                 error = string_resub("<li> <center>", "<br", tmpstr, 0);
    191                 string_deltags(error);
    192                 error = strstrip(error);
    193                 if(error == NULL || strlen(error) == 0)
    194                         error = ostrcat(_("The page is temporarily unavailable"), NULL, 0, 0);
    195                 textbox(_("Message"), error, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 400, 0, 0);
    196                 goto end;
    197         }
     99        playurl = string_resub("<meta base=\"", "vod/\"", tmpstr, 0);
     100        app = ostrcat("vod/", NULL, 0, 0);
     101        playpath = string_resub("<video src=\"", "\"", tmpstr, 0);
     102        swfUrl= ostrcat("http://static.flashx.tv/player6/jwplayer.flash.swf", NULL, 0, 0);
     103        pageUrl = ostrcat(link, NULL, 0, 0);
     104        swfVfy = ostrcat("true", NULL, 0, 0);
     105       
     106        streamlink = ostrcat(streamlink, playurl, 1, 0);
     107        streamlink = ostrcat(streamlink, " app=", 1, 0);
     108        streamlink = ostrcat(streamlink, app, 1, 0);
     109        streamlink = ostrcat(streamlink, " playpath=", 1, 0);
     110        streamlink = ostrcat(streamlink, playpath, 1, 0);
     111        streamlink = ostrcat(streamlink, " swfUrl=", 1, 0);
     112        streamlink = ostrcat(streamlink, swfUrl, 1, 0);
     113        streamlink = ostrcat(streamlink, " pageUrl=", 1, 0);
     114        streamlink = ostrcat(streamlink, pageUrl, 1, 0);
     115        streamlink = ostrcat(streamlink, " swfVfy=", 1, 0);
     116        streamlink = ostrcat(streamlink, swfVfy, 1, 0);
    198117
    199         playurl = string_resub("?config=", "\"", tmpstr, 0);
    200         free(tmppath), tmppath = NULL;
    201         tmppath = ostrcat("/nuevo/player/player.swf?config=", playurl, 0, 0);
    202 // needed in post
    203 //      free(playurl), playurl = NULL;
    204 
    205         free(tmpstr); tmpstr = NULL;
    206         free(send); send = NULL;
    207 
    208         send = ostrcat(send, "GET ", 1, 0);
    209         send = ostrcat(send, tmppath, 1, 0);
    210         send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);     
    211         send = ostrcat(send, tmphost, 1, 0);
    212         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\n", 1, 0);
    213         send = ostrcat(send, "Cookie: pageredir=", 1, 0);       
    214         send = ostrcat(send, cookie1, 1, 0);
    215         send = ostrcat(send, "; PHPSESSID=", 1, 0);     
    216         send = ostrcat(send, cookie2, 1, 0);   
    217         send = ostrcat(send, "\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n", 1, 0);   
    218         debug(99, "#############################################################################################################");
    219         debug(99, "send4: %s", send);
    220         debug(99, "#############################################################################################################");
    221 
    222         tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
    223         debug(99, "tmpstr: %s", tmpstr);
    224         titheklog(debuglevel, "/tmp/flashx_tmpstr_get4", NULL, NULL, NULL, tmpstr);
    225 
    226         if(tmpstr == NULL || ostrstr(tmpstr, "<center>Video not found, deleted or abused, sorry!<br") != NULL)
    227         {
    228                 error = string_resub("<li> <center>", "<br", tmpstr, 0);
    229                 string_deltags(error);
    230                 error = strstrip(error);
    231                 if(error == NULL || strlen(error) == 0)
    232                         error = ostrcat(_("The page is temporarily unavailable"), NULL, 0, 0);
    233                 textbox(_("Message"), error, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 400, 0, 0);
    234                 goto end;
    235         }
    236 
    237         free(tmppath), tmppath = NULL;
    238         tmpstr2 = ostrcat("http://", tmphost, 0, 0);
    239         tmppath = string_replace(tmpstr2, "", playurl, 0);
    240         free(tmpstr2); tmpstr2 = NULL;         
    241         free(playurl), playurl = NULL;
    242         free(tmpstr); tmpstr = NULL;
    243         free(send); send = NULL;
    244 
    245         send = ostrcat(send, "GET ", 1, 0);
    246         send = ostrcat(send, tmppath, 1, 0);
    247         send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);     
    248         send = ostrcat(send, tmphost, 1, 0);
    249         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\n", 1, 0);
    250         send = ostrcat(send, "Cookie: pageredir=", 1, 0);       
    251         send = ostrcat(send, cookie1, 1, 0);
    252         send = ostrcat(send, "; PHPSESSID=", 1, 0);     
    253         send = ostrcat(send, cookie2, 1, 0);   
    254         send = ostrcat(send, "\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n", 1, 0);   
    255         debug(99, "#############################################################################################################");
    256         debug(99, "send6: %s", send);
    257         debug(99, "#############################################################################################################");
    258 
    259         tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
    260         debug(99, "tmpstr: %s", tmpstr);
    261         titheklog(debuglevel, "/tmp/flashx_tmpstr_get5", NULL, NULL, NULL, tmpstr);
    262 
    263         if(tmpstr == NULL || ostrstr(tmpstr, "<center>Video not found, deleted or abused, sorry!<br") != NULL)
    264         {
    265                 error = string_resub("<li> <center>", "<br", tmpstr, 0);
    266                 string_deltags(error);
    267                 error = strstrip(error);
    268                 if(error == NULL || strlen(error) == 0)
    269                         error = ostrcat(_("The page is temporarily unavailable"), NULL, 0, 0);
    270                 textbox(_("Message"), error, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 400, 0, 0);
    271                 goto end;
    272         }
    273 
    274         streamlink = string_resub("<file>", "</file>", tmpstr, 0);
    275118        titheklog(debuglevel, "flashx_streamlink", NULL, NULL, NULL, tmpstr);
    276119
Note: See TracChangeset for help on using the changeset viewer.