Ignore:
Timestamp:
10/14/13 17:23:06 (10 years ago)
Author:
obi
Message:

[tithek] fix putlocker / sockshare

File:
1 edited

Legend:

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

    r24251 r24309  
    1717        char* serverid = NULL;
    1818        char* usender = NULL;
    19         char* line = NULL;
    20         char* lines = NULL;     
    21         char* cmd = NULL;
    2219        char* streamlink = NULL;
    2320        char* streamlink1 = NULL;
     21        char* tmpstr2 = NULL;
    2422
    2523        unlink("/tmp/tithek/get");
     
    3533        debug(99, "tmpfile: %s", tmpfile);
    3634
    37         send = ostrcat(send, "GET /file/", 1, 0);
    38         send = ostrcat(send, file, 1, 0);
    39         send = ostrcat(send, " HTTP/1.1\r\nHost: www.", 1, 0); 
    40         send = ostrcat(send, host, 1, 0);
     35        send = ostrcat(send, "GET ", 1, 0);
     36        send = ostrcat(send, tmpfile, 1, 0);
     37        send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);     
     38        send = ostrcat(send, tmphost, 1, 0);
    4139        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);       
    42        
    43         debug(99, "tmphost: %s", tmphost);
    44         debug(99, "tmpfile: %s", tmpfile);
    4540        debug(99, "send: %s", send);
    4641
    47         gethttpreal(tmphost, tmpfile, 80, "/tmp/tithek/get", NULL, NULL, 0, send, NULL, 5000, 1);
    48         sleep(1);
     42        tmpstr = gethttpreal(tmphost, tmpfile, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
    4943        free(send); send = NULL;
    50        
    51         if(!file_exist("/tmp/tithek/get"))
    52         {
    53                 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);
    54                 goto end;
    55         }
    56         if(debuglevel == 99) system("cp -a /tmp/tithek/get /tmp/putlocker1_tmpstr_get");
    57 
    58         char* header = NULL;
    59         header = command("cat /tmp/tithek/get");
    60        
    61         phpsessid = getxmlentry(header, "PHPSESSID=");
     44        phpsessid = getxmlentry(tmpstr, "PHPSESSID=");
    6245        debug(99, "phpsessid: %s", phpsessid);
    63         serverid = getxmlentry(header, "SERVERID=");
     46        serverid = getxmlentry(tmpstr, "SERVERID=");
    6447        debug(99, "serverid: %s", serverid);
    65         usender = getxmlentry(header, "usender=");
     48        usender = getxmlentry(tmpstr, "usender=");
    6649        debug(99, "usender: %s", usender);
    67         free(header), header = NULL;
    68 
    69         line = string_newline(command("cat /tmp/tithek/get | grep 'Set-Cookie:' -n | tail -n1| cut -d':' -f1"));
    70         cmd = ostrcat(cmd, "cat /tmp/tithek/get | wc -l", 1, 0);
    71         lines = string_newline(command(cmd));
    72         free(cmd); cmd = NULL;
    73         debug(99, "line: %s", line);
    74         debug(99, "lines: %s", lines);
    75 
    76         if(lines == NULL || line == NULL) goto end;     
    77        
    78         int sline = atoi(lines) - atoi(line) - 1;
    79         debug(99, "sline: %d", sline);
    80         debug(99, "sline: %s", oitoa(sline));
    81 
    82         cmd = ostrcat(cmd, "cat /tmp/tithek/get | tail -n", 1, 0);
    83         cmd = ostrcat(cmd, oitoa(sline), 1, 0);
    84         cmd = ostrcat(cmd, " | sed '1,1d' | zcat", 1, 0);
    85         debug(99, "cmd: %s", cmd);     
    86         tmpstr = command(cmd);
    87         free(cmd); cmd = NULL;
    88         free(lines); lines = NULL;
    89         titheklog(debuglevel, "/tmp/putlocker2_tmpstr_zcat", NULL, tmpstr);
    9050
    9151        //get hash from tmpstr
    9252        char* pos = ostrstr(tmpstr, "<input type=\"hidden\" value=");
     53        debug(99, "tmpstr: %s", tmpstr);
    9354        hashstr = getxmlentry(pos, "value=");
     55// free(tmpstr) after getxml or segfault...
    9456        free(tmpstr); tmpstr = NULL;
    9557        debug(99, "hashstr: %s", hashstr);
     
    12183        debug(99, "send: %s", send);
    12284
    123         sleep(7);
    124         //send and receive answer
    125         gethttpreal(tmphost, tmpfile, 80, "/tmp/tithek/x9", NULL, NULL, 0, send, NULL, 5000, 0);
    126         sleep(1);
    127         if(debuglevel == 99) system("cp -a /tmp/tithek/x9 /tmp/putlocker3_tmpstr_post");
    128 
     85//      sleep(7);
     86        tmpstr = gethttpreal(tmphost, tmpfile, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
    12987        free(send); send = NULL;
    130         tmpstr = command("cat /tmp/tithek/x9 | sed '1,1d' | zcat");
     88        debug(99, "tmpstr: %s", tmpstr);
    13189        titheklog(debuglevel, "/tmp/putlocker4_tmpstr_post_zcat", NULL, tmpstr);
    13290       
    13391        if(ostrstr(tmpstr, "warning_message") != NULL)
    13492        {
    135                 tmpstr = string_resub("<div class='warning_message'>", "</div>", tmpstr, 0);
    136                 tmpstr = strstrip(tmpstr);
    137                 if(tmpstr == NULL || strlen(tmpstr) == 0)
    138                         tmpstr = ostrcat(_("The page is temporarily unavailable"), tmpstr, 0, 1);
    139                 textbox(_("Message"), _(tmpstr) , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
     93                tmpstr2 = string_resub("<div class='warning_message'>", "</div>", tmpstr, 0);
     94                tmpstr2 = strstrip(tmpstr2);
     95                if(tmpstr2 == NULL || strlen(tmpstr2) == 0)
     96                        tmpstr2 = ostrcat(_("The page is temporarily unavailable"), NULL, 0, 0);
     97                textbox(_("Message"), _(tmpstr2) , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
    14098                goto end;
    14199        }
     100
    142101        if(phpsessid == NULL || serverid == NULL) goto end;                     
    143102
     
    147106        else
    148107        {
    149                 streamlink = string_resub("/get_file.php", "\">Download File</a>", tmpstr, 0); 
     108                streamlink = string_resub("/get_file.php", "\">Download File</a>", tmpstr, 0);
    150109                streamlink1 = ostrcat("http://www.", host, 0, 0);
    151110                streamlink1 = ostrcat(streamlink1, "/get_file.php", 1, 0);
    152111                streamlink1 = ostrcat(streamlink1, streamlink, 1, 0);
    153                 debug(99, "stream downloadlink");
     112                debug(99, "stream downloadlink: %s", streamlink1);
    154113                goto end;
    155114        }
    156 
    157115        debug(99, "streamlink: %s", streamlink);
    158116
     
    163121        }
    164122        free(tmpstr); tmpstr = NULL;
     123
    165124        if(streamlink == NULL) goto end;
    166125
     
    176135        send = ostrcat(send, "\r\nConnection: close\r\nUser-Agent: Python-urllib/2.6\r\n\r\n", 1, 0);
    177136
    178         sleep(5);
     137//      sleep(5);
    179138       
    180         //send and receive answer
    181139        tmpstr = gethttpreal(tmphost, tmpfile, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 0);
    182140        free(send); send = NULL;
    183 
    184141        titheklog(debuglevel, "/tmp/putlocker5_tmpstr_get", NULL, tmpstr);
    185 
    186 //Streaming version of this file is currently not available. You can download it below.
    187142
    188143        //get streamlink1
     
    196151        free(tmpfile); tmpfile = NULL;
    197152        free(tmpstr); tmpstr = NULL;
     153        free(tmpstr2); tmpstr2 = NULL;
    198154        free(send); send = NULL;
    199155        free(hash); hash = NULL;
Note: See TracChangeset for help on using the changeset viewer.