Changeset 24309 for titan/plugins/tithek/putlocker.h
- Timestamp:
- 10/14/13 17:23:06 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/plugins/tithek/putlocker.h
r24251 r24309 17 17 char* serverid = NULL; 18 18 char* usender = NULL; 19 char* line = NULL;20 char* lines = NULL;21 char* cmd = NULL;22 19 char* streamlink = NULL; 23 20 char* streamlink1 = NULL; 21 char* tmpstr2 = NULL; 24 22 25 23 unlink("/tmp/tithek/get"); … … 35 33 debug(99, "tmpfile: %s", tmpfile); 36 34 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); 41 39 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);45 40 debug(99, "send: %s", send); 46 41 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); 49 43 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="); 62 45 debug(99, "phpsessid: %s", phpsessid); 63 serverid = getxmlentry( header, "SERVERID=");46 serverid = getxmlentry(tmpstr, "SERVERID="); 64 47 debug(99, "serverid: %s", serverid); 65 usender = getxmlentry( header, "usender=");48 usender = getxmlentry(tmpstr, "usender="); 66 49 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);90 50 91 51 //get hash from tmpstr 92 52 char* pos = ostrstr(tmpstr, "<input type=\"hidden\" value="); 53 debug(99, "tmpstr: %s", tmpstr); 93 54 hashstr = getxmlentry(pos, "value="); 55 // free(tmpstr) after getxml or segfault... 94 56 free(tmpstr); tmpstr = NULL; 95 57 debug(99, "hashstr: %s", hashstr); … … 121 83 debug(99, "send: %s", send); 122 84 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); 129 87 free(send); send = NULL; 130 tmpstr = command("cat /tmp/tithek/x9 | sed '1,1d' | zcat");88 debug(99, "tmpstr: %s", tmpstr); 131 89 titheklog(debuglevel, "/tmp/putlocker4_tmpstr_post_zcat", NULL, tmpstr); 132 90 133 91 if(ostrstr(tmpstr, "warning_message") != NULL) 134 92 { 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); 140 98 goto end; 141 99 } 100 142 101 if(phpsessid == NULL || serverid == NULL) goto end; 143 102 … … 147 106 else 148 107 { 149 streamlink = string_resub("/get_file.php", "\">Download File</a>", tmpstr, 0); 108 streamlink = string_resub("/get_file.php", "\">Download File</a>", tmpstr, 0); 150 109 streamlink1 = ostrcat("http://www.", host, 0, 0); 151 110 streamlink1 = ostrcat(streamlink1, "/get_file.php", 1, 0); 152 111 streamlink1 = ostrcat(streamlink1, streamlink, 1, 0); 153 debug(99, "stream downloadlink ");112 debug(99, "stream downloadlink: %s", streamlink1); 154 113 goto end; 155 114 } 156 157 115 debug(99, "streamlink: %s", streamlink); 158 116 … … 163 121 } 164 122 free(tmpstr); tmpstr = NULL; 123 165 124 if(streamlink == NULL) goto end; 166 125 … … 176 135 send = ostrcat(send, "\r\nConnection: close\r\nUser-Agent: Python-urllib/2.6\r\n\r\n", 1, 0); 177 136 178 sleep(5);137 // sleep(5); 179 138 180 //send and receive answer181 139 tmpstr = gethttpreal(tmphost, tmpfile, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 0); 182 140 free(send); send = NULL; 183 184 141 titheklog(debuglevel, "/tmp/putlocker5_tmpstr_get", NULL, tmpstr); 185 186 //Streaming version of this file is currently not available. You can download it below.187 142 188 143 //get streamlink1 … … 196 151 free(tmpfile); tmpfile = NULL; 197 152 free(tmpstr); tmpstr = NULL; 153 free(tmpstr2); tmpstr2 = NULL; 198 154 free(send); send = NULL; 199 155 free(hash); hash = NULL;
Note: See TracChangeset
for help on using the changeset viewer.