Ignore:
Timestamp:
10/13/13 01:07:23 (10 years ago)
Author:
obi
Message:

[tithek] fix flashx hoster

File:
1 edited

Legend:

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

    r24237 r24252  
    22#define FLASHX_H
    33
    4 char* flashx(char* host, char* file)
     4char* flashx(char* host, char* file, char* hosterurl)
    55{
    6         debug(99, "in host: %s file: %s", host, file);
    7         int debuglevel = getconfigint("debuglevel", NULL);
     6        debug(99, "host: %s file: %s", host, file);
     7        debug(99, "hosterurl: %s", hosterurl);
    88        char* tmphost = NULL;
    9         char* tmpfile = NULL;
     9        char* tmppath = NULL;
    1010        char* tmpstr = NULL;
    1111        char* send = NULL;
    12         char* ip = NULL;
    1312        char* streamlink = NULL;
    14 
    15         unlink("/tmp/tithek/x9");
     13        char* ip = NULL, *pos = NULL, *path = NULL;
    1614
    1715        if(host == NULL || file == NULL) return NULL;
    1816
    19         tmphost = ostrcat("www.", host, 0, 0);
    20         tmpfile = ostrcat("/file/", file, 0, 0);
    21         debug(99, "tmphost: %s", tmphost);
    22         ip = get_ip(tmphost);
    23         debug(99, "ip: %s", ip);
    24         debug(99, "tmpfile: %s", tmpfile);
    25         debug(99, "file: %s", file);
    26 
    27         send = ostrcat(send, "GET /player/embed_player.php?vid=", 1, 0);
    28         send = ostrcat(send, file, 1, 0);
    29         send = ostrcat(send, " HTTP/1.1\r\nHost: www.", 1, 0); 
    30         send = ostrcat(send, host, 1, 0);
     17        ip = string_replace("http://", "", (char*)hosterurl, 0);
     18
     19        if(ip != NULL)
     20                pos = strchr(ip, '/');
     21        if(pos != NULL)
     22        {
     23                pos[0] = '\0';
     24                path = pos + 1;
     25        }
     26       
     27        tmphost = ostrcat(ip, NULL, 0, 0);
     28        tmppath = ostrcat("/", path, 0, 0);
     29       
     30//printf("\n#######################################################\n");
     31//printf("GET /video/UX98AKXU2ARB/RiddickUeberlebenistseineRacheTSLDGermanX264-AOE\n");
     32//printf("tmphost: %s\n",tmphost);
     33//printf("tmppath: %s\n",tmppath);
     34//printf("\n#######################################################\n");
     35        send = ostrcat(send, "GET ", 1, 0);
     36        send = ostrcat(send, tmppath, 1, 0);
     37        send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);     
     38        send = ostrcat(send, tmphost, 1, 0);
    3139        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);       
    32         debug(99, "tmphost: %s", tmphost);
    33         debug(99, "tmpfile: %s", tmpfile);
    34         debug(99, "send: %s", send);
    35         tmpstr = gethttpreal(tmphost, tmpfile, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
    36 
    37         titheklog(debuglevel, "/tmp/flashx1_tmpstr_get1", NULL, tmpstr);
    38 
    39         free(tmpstr); tmpstr = NULL;
    40         free(send); send = NULL;
    41         sleep(1);
    42 
    43         send = ostrcat(send, "GET /player/embed_player.php?vid=", 1, 0);
    44         send = ostrcat(send, file, 1, 0);
    45         send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);     
    46         send = ostrcat(send, host, 1, 0);
    47         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);       
    48         debug(99, "tmphost: %s", tmphost);
    49         debug(99, "tmpfile: %s", tmpfile);
    50         debug(99, "send: %s", send);
    51         tmpstr = gethttpreal(tmphost, tmpfile, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
    52 
    53         titheklog(debuglevel, "/tmp/flashx2_tmpstr_get2", NULL, tmpstr);
    54 
    55         free(tmpstr); tmpstr = NULL;
    56         free(send); send = NULL;
    57         sleep(1);
    58 
    59         send = ostrcat(send, "GET /nuevo/player/cst.php?hash=", 1, 0);
    60         send = ostrcat(send, file, 1, 0);
    61         send = ostrcat(send, " HTTP/1.1\r\nHost: play.flashx.tv\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);       
    62         debug(99, "tmphost: %s", tmphost);
    63         debug(99, "tmpfile: %s", tmpfile);
    64         debug(99, "send: %s", send);
    65         gethttpreal(tmphost, tmpfile, 80, "/tmp/tithek/x9", NULL, NULL, 0, send, NULL, 5000, 0);
    66 
    67         if(!file_exist("/tmp/tithek/x9"))
    68         {
    69                 textbox(_("Message"), _("This file doesn't exist, or has been removed") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
    70                 goto end;
    71         }
    72 
    73         if(debuglevel == 99) system("cp -a /tmp/tithek/x9 /tmp/flashx3_tmpstr_get3");
    74 
    75         free(send); send = NULL;
    76         tmpstr = command("cat /tmp/tithek/x9 | sed '1,1d' | zcat");
    77 
    78         titheklog(debuglevel, "/tmp/flashx4_tmpstr_get3_zcat", NULL, tmpstr);
     40        debug(99, "send: %s", send);
     41        tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
     42        if(getconfigint("debuglevel", NULL) == 99)
     43                writesys("/tmp/flashx_tmpstr_get1", tmpstr, 0);
     44//      writesys("/var/usr/local/share/titan/plugins/tithek//flashx_tmpstr_get1", tmpstr, 0);
     45//printf("\n#######################################################\n");
     46
     47        char* cookie1 = string_resub("Set-Cookie: pageredir=", ";", tmpstr, 0);
     48        debug(99, "cookie1: %s", cookie1);
     49
     50        char* cookie2 = string_resub("Set-Cookie: PHPSESSID=", ";", tmpstr, 0);
     51        debug(99, "cookie2: %s", cookie2);
     52
     53        char* cookie3 = string_resub("Set-Cookie: video_", "=", tmpstr, 0);
     54        debug(99, "cookie3: %s", cookie3);
     55       
     56        free(tmppath), tmppath = NULL;
     57        tmppath = ostrcat("/player/embed.php?vid=", cookie3, 0, 0);
     58        free(tmphost), tmphost = NULL;
     59        char* tmphost1 = oregex(".*<iframe width=.*src=\"(http://.*)&width.*", tmpstr);
     60        tmphost = string_resub("http://", "/", tmphost1, 0);
     61        free(tmphost1), tmphost1 = NULL;
     62        free(tmpstr); tmpstr = NULL;
     63        free(send); send = NULL;
     64//      sleep(1);
     65//printf("\n#######################################################\n");
     66//printf("GET /player/embed.php?vid=1008580\n");
     67//printf("tmphost: %s\n",tmphost);
     68//printf("tmppath: %s\n",tmppath);
     69//printf("\n#######################################################\n");
     70        send = ostrcat(send, "GET ", 1, 0);
     71        send = ostrcat(send, tmppath, 1, 0);
     72        send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);     
     73        send = ostrcat(send, tmphost, 1, 0);   
     74        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);
     75
     76        send = ostrcat(send, "Cookie: pageredir=", 1, 0);       
     77        send = ostrcat(send, cookie1, 1, 0);
     78        send = ostrcat(send, "; PHPSESSID=", 1, 0);     
     79        send = ostrcat(send, cookie2, 1, 0);   
     80        send = ostrcat(send, "\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n", 1, 0);   
     81        debug(99, "send: %s", send);
     82        tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
     83
     84        if(getconfigint("debuglevel", NULL) == 99)
     85                writesys("/tmp/flashx_tmpstr_get2", tmpstr, 0);
     86//      writesys("/var/usr/local/share/titan/plugins/tithek//flashx_tmpstr_get2", tmpstr, 0);
     87//printf("\n#######################################################\n");
     88
     89        char* hash1tmp = string_resub("<input type=\"hidden\" name=\"sec\" value=\"", "\"", tmpstr, 0);
     90        char* hash2tmp = string_resub("<input type=\"hidden\" name=\"id\" value=\"", "\"", tmpstr, 0);
     91       
     92        char* hash1 = htmlencode(hash1tmp);
     93        char* hash2 = htmlencode(hash2tmp);
     94       
     95        // htmldecod cant / to %2f
     96//      hash1 = string_replace_all("/", "%2F", hash1, 1);
     97//      hash2 = string_replace_all("/", "%2F", hash2, 1);
     98
     99        char* hash = ostrcat("sec=", hash1, 0, 0);
     100        hash = ostrcat(hash, "&id=", 0, 0);
     101        hash = ostrcat(hash, hash2, 0, 0);
     102        char* hashlen = NULL;
     103        hashlen = oitoa(strlen(hash));
     104        debug(99, "hashlen: %s", hashlen);
     105
     106        free(tmpstr); tmpstr = NULL;
     107        free(send); send = NULL;
     108//      sleep(1);
     109
     110//printf("\n#######################################################\n");
     111//printf("POST /player/show.php\n");
     112//printf("\n#######################################################\n");       
     113
     114        send = ostrcat(send, "POST /player/show.php HTTP/1.1\r\nContent-Length: ", 1, 0);
     115        send = ostrcat(send, hashlen, 1, 0);
     116        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);
     117        send = ostrcat(send, tmphost, 1, 0);
     118        send = ostrcat(send, "\r\nCookie: 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\nContent-Type: application/x-www-form-urlencoded\r\n\r\n", 1, 0);     
     123        send = ostrcat(send, hash, 1, 0);
     124
     125        debug(99, "send: %s", send);
     126        tmpstr = gethttpreal(tmphost, "/player/show.php", 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
     127
     128        if(getconfigint("debuglevel", NULL) == 99)
     129                writesys("/tmp/flashx_tmpstr_get3", tmpstr, 0);
     130//      writesys("/var/usr/local/share/titan/plugins/tithek//flashx_tmpstr_get3", tmpstr, 0);
     131//printf("\n#######################################################\n");
     132//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">';
     133        char* playurl = string_resub("?config=", "\"", tmpstr, 0);
     134        free(tmppath), tmppath = NULL;
     135        tmppath = ostrcat("/nuevo/player/player.swf?config=", playurl, 0, 0);
     136//      free(playurl), playurl = NULL;
     137
     138        free(tmpstr); tmpstr = NULL;
     139        free(send); send = NULL;
     140//      sleep(1);
     141
     142//printf("\n#######################################################\n");
     143//printf("GET /nuevo/player/player.swf?config=http://play.flashx.tv/nuevo/player/play.php?str=4MfrzrW70J.wp8O.zZi5uLo=\n");
     144//printf("tmphost: %s\n",tmphost);
     145//printf("tmppath: %s\n",tmppath);
     146//printf("\n#######################################################\n");       
     147
     148        send = ostrcat(send, "GET ", 1, 0);
     149        send = ostrcat(send, tmppath, 1, 0);
     150        send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);     
     151        send = ostrcat(send, tmphost, 1, 0);
     152        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);
     153        send = ostrcat(send, "Cookie: pageredir=", 1, 0);       
     154        send = ostrcat(send, cookie1, 1, 0);
     155        send = ostrcat(send, "; PHPSESSID=", 1, 0);     
     156        send = ostrcat(send, cookie2, 1, 0);   
     157        send = ostrcat(send, "\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n", 1, 0);   
     158
     159
     160        debug(99, "send: %s", send);
     161        tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
     162
     163        if(getconfigint("debuglevel", NULL) == 99)
     164                writesys("/tmp/flashx_tmpstr_get4", tmpstr, 0);
     165//      writesys("/var/usr/local/share/titan/plugins/tithek//flashx_tmpstr_get4", tmpstr, 0);
     166//printf("\n#######################################################\n");
     167
     168
     169
     170//printf("tmppath: %s\n",tmppath);
     171//printf("playurl: %s\n",playurl);
     172        free(tmppath), tmppath = NULL;
     173//      tmppath = ostrcat("/nuevo/player/play.php?str=4MfrzrW4qrPKnM2dw5/Fvcs=", NULL, 0, 0);
     174//      tmppath = string_resub("/play.php?", "\0", tmpstr, 0);
     175        char* tmpstr2 = ostrcat("http://", tmphost, 0, 0);
     176        tmppath = string_replace(tmpstr2, "", playurl, 0);
     177
     178        free(tmpstr2); tmpstr2 = NULL;         
     179        free(playurl), playurl = NULL;
     180        free(tmpstr); tmpstr = NULL;
     181        free(send); send = NULL;
     182//      sleep(1);
     183       
     184//printf("\n#######################################################\n");
     185//printf("GET /nuevo/player/play.php?str=4MfrzrW70J.wp8O.zZi5uLo=\n");
     186//printf("tmphost: %s\n",tmphost);
     187//printf("tmppath: %s\n",tmppath);
     188
     189//printf("\n#######################################################\n");       
     190
     191        send = ostrcat(send, "GET ", 1, 0);
     192        send = ostrcat(send, tmppath, 1, 0);
     193        send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);     
     194        send = ostrcat(send, tmphost, 1, 0);
     195        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);
     196        send = ostrcat(send, "Cookie: pageredir=", 1, 0);       
     197        send = ostrcat(send, cookie1, 1, 0);
     198        send = ostrcat(send, "; PHPSESSID=", 1, 0);     
     199        send = ostrcat(send, cookie2, 1, 0);   
     200        send = ostrcat(send, "\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n", 1, 0);   
     201
     202
     203        debug(99, "send: %s", send);
     204        tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
     205
     206        if(getconfigint("debuglevel", NULL) == 99)
     207                writesys("/tmp/flashx_tmpstr_get5", tmpstr, 0);
     208//      writesys("/var/usr/local/share/titan/plugins/tithek//flashx_tmpstr_get5", tmpstr, 0);
     209//printf("\n#######################################################\n");
    79210
    80211        streamlink = string_resub("<file>", "</file>", tmpstr, 0);
    81         titheklog(debuglevel, "/tmp/flashx5_streamlink", NULL, streamlink);
    82 
    83 end:
     212        if(getconfigint("debuglevel", NULL) == 99)
     213                writesys("/tmp/flashx5_streamlink", streamlink, 0);
     214
     215//end:
    84216        free(tmphost); tmphost = NULL;
    85         free(tmpfile); tmpfile = NULL;
     217        free(tmphost); tmphost = NULL;
    86218        free(tmpstr); tmpstr = NULL;
    87219        free(send); send = NULL;
Note: See TracChangeset for help on using the changeset viewer.