Changeset 24273


Ignore:
Timestamp:
10/13/13 17:20:53 (9 years ago)
Author:
obi
Message:

[titan] tithek cleanup flashx

File:
1 edited

Legend:

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

    r24255 r24273  
    88        debug(99, "hosterurl: %s", hosterurl);
    99        int debuglevel = getconfigint("debuglevel", NULL);
    10         char* tmphost = NULL, *tmppath = NULL, *tmpstr = NULL, *send = NULL, *streamlink = NULL, *ip = NULL, *pos = NULL, *path = NULL, *error = NULL;
    11 
     10        char* tmphost = NULL, *tmppath = NULL, *tmpstr = NULL, *send = NULL, *streamlink = NULL, *ip = NULL, *pos = NULL, *path = NULL;
     11        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;
    1212        if(host == NULL || file == NULL) return NULL;
    1313
     
    2525        tmppath = ostrcat("/", path, 0, 0);
    2626       
    27 //printf("\n#######################################################\n");
    28 //printf("GET /video/UX98AKXU2ARB/RiddickUeberlebenistseineRacheTSLDGermanX264-AOE\n");
    29 //printf("tmphost: %s\n",tmphost);
    30 //printf("tmppath: %s\n",tmppath);
    31 //printf("\n#######################################################\n");
    3227        send = ostrcat(send, "GET ", 1, 0);
    3328        send = ostrcat(send, tmppath, 1, 0);
     
    3631        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);       
    3732        debug(99, "send: %s", send);
    38         tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
     33
     34        tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
     35        debug(99, "tmpstr: %s", tmpstr);
    3936        titheklog(debuglevel, "/tmp/flashx_tmpstr_get1", NULL, tmpstr);
    40         writesys("/var/usr/local/share/titan/plugins/tithek//flashx_tmpstr_get1", tmpstr, 0);
    41 //printf("\n#######################################################\n");
    4237 
    43         if(ostrstr(tmpstr, "<center>Video not found, deleted or abused, sorry!<br") != NULL)
    44         {
    45                 error = string_resub("<li> <center>", "<br", tmpstr, 0);
    46                 string_deltags(error);
    47                 error = strstrip(error);
    48                 if(error == NULL || strlen(error) == 0)
    49                         error = ostrcat(_("The page is temporarily unavailable"), NULL, 0, 0);
    50                 textbox(_("Message"), error, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 400, 0, 0);
    51                 goto end;
    52         }
    53        
    54         char* cookie1 = string_resub("Set-Cookie: pageredir=", ";", tmpstr, 0);
    55         debug(99, "cookie1: %s", cookie1);
    56 
    57         char* cookie2 = string_resub("Set-Cookie: PHPSESSID=", ";", tmpstr, 0);
    58         debug(99, "cookie2: %s", cookie2);
    59 
    60         char* cookie3 = string_resub("Set-Cookie: video_", "=", tmpstr, 0);
    61         debug(99, "cookie3: %s", cookie3);
     38        if(tmpstr == NULL || ostrstr(tmpstr, "<center>Video not found, deleted or abused, sorry!<br") != NULL)
     39        {
     40                error = string_resub("<li> <center>", "<br", tmpstr, 0);
     41                string_deltags(error);
     42                error = strstrip(error);
     43                if(error == NULL || strlen(error) == 0)
     44                        error = ostrcat(_("The page is temporarily unavailable"), NULL, 0, 0);
     45                textbox(_("Message"), error, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 400, 0, 0);
     46                goto end;
     47        }
     48       
     49        cookie1 = string_resub("Set-Cookie: pageredir=", ";", tmpstr, 0);
     50        debug(99, "cookie1 (pageredir): %s", cookie1);
     51
     52        cookie2 = string_resub("Set-Cookie: PHPSESSID=", ";", tmpstr, 0);
     53        debug(99, "cookie2 (PHPSESSID): %s", cookie2);
     54
     55        cookie3 = string_resub("Set-Cookie: video_", "=", tmpstr, 0);
     56        debug(99, "cookie3 (vid): %s", cookie3);
    6257       
    6358        free(tmppath), tmppath = NULL;
    6459        tmppath = ostrcat("/player/embed.php?vid=", cookie3, 0, 0);
    6560        free(tmphost), tmphost = NULL;
    66         char* tmphost1 = oregex(".*<iframe width=.*src=\"(http://.*)&width.*", tmpstr);
     61        tmphost1 = oregex(".*<iframe width=.*src=\"(http://.*)&width.*", tmpstr);
    6762        tmphost = string_resub("http://", "/", tmphost1, 0);
    6863        free(tmphost1), tmphost1 = NULL;
    6964        free(tmpstr); tmpstr = NULL;
    7065        free(send); send = NULL;
    71 //      sleep(1);
    72 //printf("\n#######################################################\n");
    73 //printf("GET /player/embed.php?vid=1008580\n");
    74 //printf("tmphost: %s\n",tmphost);
    75 //printf("tmppath: %s\n",tmppath);
    76 //printf("\n#######################################################\n");
     66
    7767        send = ostrcat(send, "GET ", 1, 0);
    7868        send = ostrcat(send, tmppath, 1, 0);
     
    8777        send = ostrcat(send, "\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n", 1, 0);   
    8878        debug(99, "send: %s", send);
    89         tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
    90 
     79
     80        tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
    9181        titheklog(debuglevel, "/tmp/flashx_tmpstr_get2", NULL, tmpstr);
    92         writesys("/var/usr/local/share/titan/plugins/tithek//flashx_tmpstr_get2", tmpstr, 0);
    93 //printf("\n#######################################################\n");
    94 
    95         char* hash1tmp = string_resub("<input type=\"hidden\" name=\"sec\" value=\"", "\"", tmpstr, 0);
    96         char* hash2tmp = string_resub("<input type=\"hidden\" name=\"id\" value=\"", "\"", tmpstr, 0);
     82        debug(99, "tmpstr: %s", tmpstr);
     83
     84        if(tmpstr == NULL || ostrstr(tmpstr, "<center>Video not found, deleted or abused, sorry!<br") != NULL)
     85        {
     86                error = string_resub("<li> <center>", "<br", tmpstr, 0);
     87                string_deltags(error);
     88                error = strstrip(error);
     89                if(error == NULL || strlen(error) == 0)
     90                        error = ostrcat(_("The page is temporarily unavailable"), NULL, 0, 0);
     91                textbox(_("Message"), error, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 400, 0, 0);
     92                goto end;
     93        }
     94
     95        hash1tmp = string_resub("<input type=\"hidden\" name=\"sec\" value=\"", "\"", tmpstr, 0);
     96        hash2tmp = string_resub("<input type=\"hidden\" name=\"id\" value=\"", "\"", tmpstr, 0);
    9797       
    9898        if(hash1tmp == NULL || hash2tmp == NULL) goto end;
    99         char* hash1 = htmlencode(hash1tmp);
    100         char* hash2 = htmlencode(hash2tmp);
     99        hash1 = htmlencode(hash1tmp);
     100        hash2 = htmlencode(hash2tmp);
    101101        free(hash1tmp); hash1tmp = NULL;
    102102        free(hash2tmp); hash2tmp = NULL;
     
    106106//      hash2 = string_replace_all("/", "%2F", hash2, 1);
    107107
    108         char* hash = ostrcat("sec=", hash1, 0, 0);
     108        hash = ostrcat("sec=", hash1, 0, 0);
    109109        hash = ostrcat(hash, "&id=", 0, 0);
    110110        hash = ostrcat(hash, hash2, 0, 0);
     
    114114        hashlen = oitoa(strlen(hash));
    115115        debug(99, "hashlen: %s", hashlen);
    116 
    117         free(tmpstr); tmpstr = NULL;
    118         free(send); send = NULL;
    119 //      sleep(1);
    120 
    121 //printf("\n#######################################################\n");
    122 //printf("POST /player/show.php\n");
    123 //printf("\n#######################################################\n");       
     116        free(tmpstr); tmpstr = NULL;
     117        free(send); send = NULL;
    124118
    125119        send = ostrcat(send, "POST /player/show.php HTTP/1.1\r\nContent-Length: ", 1, 0);
     
    138132        debug(99, "send: %s", send);
    139133        tmpstr = gethttpreal(tmphost, "/player/show.php", 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
    140 
     134        debug(99, "tmpstr: %s", tmpstr);
    141135        titheklog(debuglevel, "/tmp/flashx_tmpstr_get3", NULL, tmpstr);
    142         writesys("/var/usr/local/share/titan/plugins/tithek//flashx_tmpstr_get3", tmpstr, 0);
    143 //printf("\n#######################################################\n");
    144 //var code ='<object id="nuevoplayer" width="'+ww+'" height="'+hh+'" data="http://play.flashx.tv/nuevo/player/player.swf?config=http://play.flashx.tv/nuevo/player/play.php?str=4MfrzrW4qrPKnM2dw5/Fvcs=" type="application/x-shockwave-flash">';
    145         char* playurl = string_resub("?config=", "\"", tmpstr, 0);
     136
     137        if(tmpstr == NULL || ostrstr(tmpstr, "<center>Video not found, deleted or abused, sorry!<br") != NULL)
     138        {
     139                error = string_resub("<li> <center>", "<br", tmpstr, 0);
     140                string_deltags(error);
     141                error = strstrip(error);
     142                if(error == NULL || strlen(error) == 0)
     143                        error = ostrcat(_("The page is temporarily unavailable"), NULL, 0, 0);
     144                textbox(_("Message"), error, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 400, 0, 0);
     145                goto end;
     146        }
     147
     148        playurl = string_resub("?config=", "\"", tmpstr, 0);
    146149        free(tmppath), tmppath = NULL;
    147150        tmppath = ostrcat("/nuevo/player/player.swf?config=", playurl, 0, 0);
     151// needed in post
    148152//      free(playurl), playurl = NULL;
    149153
    150154        free(tmpstr); tmpstr = NULL;
    151155        free(send); send = NULL;
    152 //      sleep(1);
    153 
    154 //printf("\n#######################################################\n");
    155 //printf("GET /nuevo/player/player.swf?config=http://play.flashx.tv/nuevo/player/play.php?str=4MfrzrW70J.wp8O.zZi5uLo=\n");
    156 //printf("tmphost: %s\n",tmphost);
    157 //printf("tmppath: %s\n",tmppath);
    158 //printf("\n#######################################################\n");       
    159156
    160157        send = ostrcat(send, "GET ", 1, 0);
     
    169166        send = ostrcat(send, "\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n", 1, 0);   
    170167
    171 
    172         debug(99, "send: %s", send);
    173         tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
    174 
     168        debug(99, "send: %s", send);
     169        tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
     170        debug(99, "tmpstr: %s", tmpstr);
    175171        titheklog(debuglevel, "/tmp/flashx_tmpstr_get4", NULL, tmpstr);
    176         writesys("/var/usr/local/share/titan/plugins/tithek//flashx_tmpstr_get4", tmpstr, 0);
    177 //printf("\n#######################################################\n");
    178 
    179 
    180 
    181 //printf("tmppath: %s\n",tmppath);
    182 //printf("playurl: %s\n",playurl);
     172
     173        if(tmpstr == NULL || ostrstr(tmpstr, "<center>Video not found, deleted or abused, sorry!<br") != NULL)
     174        {
     175                error = string_resub("<li> <center>", "<br", tmpstr, 0);
     176                string_deltags(error);
     177                error = strstrip(error);
     178                if(error == NULL || strlen(error) == 0)
     179                        error = ostrcat(_("The page is temporarily unavailable"), NULL, 0, 0);
     180                textbox(_("Message"), error, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 400, 0, 0);
     181                goto end;
     182        }
     183
    183184        free(tmppath), tmppath = NULL;
    184 //      tmppath = ostrcat("/nuevo/player/play.php?str=4MfrzrW4qrPKnM2dw5/Fvcs=", NULL, 0, 0);
    185 //      tmppath = string_resub("/play.php?", "\0", tmpstr, 0);
    186         char* tmpstr2 = ostrcat("http://", tmphost, 0, 0);
     185        tmpstr2 = ostrcat("http://", tmphost, 0, 0);
    187186        tmppath = string_replace(tmpstr2, "", playurl, 0);
    188 
    189187        free(tmpstr2); tmpstr2 = NULL;         
    190188        free(playurl), playurl = NULL;
    191189        free(tmpstr); tmpstr = NULL;
    192190        free(send); send = NULL;
    193 //      sleep(1);
    194        
    195 //printf("\n#######################################################\n");
    196 //printf("GET /nuevo/player/play.php?str=4MfrzrW70J.wp8O.zZi5uLo=\n");
    197 //printf("tmphost: %s\n",tmphost);
    198 //printf("tmppath: %s\n",tmppath);
    199 
    200 //printf("\n#######################################################\n");       
    201191
    202192        send = ostrcat(send, "GET ", 1, 0);
     
    210200        send = ostrcat(send, cookie2, 1, 0);   
    211201        send = ostrcat(send, "\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n", 1, 0);   
    212 
    213 
    214         debug(99, "send: %s", send);
    215         tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
    216 
    217         if(getconfigint("debuglevel", NULL) == 99)
    218                 writesys("/tmp/flashx_tmpstr_get5", tmpstr, 0);
    219         writesys("/var/usr/local/share/titan/plugins/tithek//flashx_tmpstr_get5", tmpstr, 0);
    220 //printf("\n#######################################################\n");
     202        debug(99, "send: %s", send);
     203
     204        tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
     205        debug(99, "tmpstr: %s", tmpstr);
     206        titheklog(debuglevel, "/tmp/flashx_tmpstr_get5", NULL, tmpstr);
     207
     208        if(tmpstr == NULL || ostrstr(tmpstr, "<center>Video not found, deleted or abused, sorry!<br") != NULL)
     209        {
     210                error = string_resub("<li> <center>", "<br", tmpstr, 0);
     211                string_deltags(error);
     212                error = strstrip(error);
     213                if(error == NULL || strlen(error) == 0)
     214                        error = ostrcat(_("The page is temporarily unavailable"), NULL, 0, 0);
     215                textbox(_("Message"), error, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 400, 0, 0);
     216                goto end;
     217        }
    221218
    222219        streamlink = string_resub("<file>", "</file>", tmpstr, 0);
    223         if(getconfigint("debuglevel", NULL) == 99)
    224                 writesys("/tmp/flashx5_streamlink", streamlink, 0);
     220        titheklog(debuglevel, "flashx_streamlink", NULL, tmpstr);
    225221
    226222end:
Note: See TracChangeset for help on using the changeset viewer.