Changeset 38776 for titan


Ignore:
Timestamp:
09/14/16 16:14:05 (7 years ago)
Author:
obi
Message:

tithek fix divxstage / cloudtime hoster

File:
1 edited

Legend:

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

    r37484 r38776  
    3939
    4040        tmphost = string_replace("http://", "", tmplink, 0);
    41         free(tmplink) , tmplink = NULL;
     41//      free(tmplink) , tmplink = NULL;
    4242
    4343        if(tmphost != NULL)
     
    6767        tmppath = string_replace("/video/", "/embed/?v=", tmppath, 1);
    6868        tmphost = ostrcat("www.cloudtime.to", NULL, 0, 0);
    69 
     69/*
    7070        send = ostrcat(send, "GET ", 1, 0);
    7171        send = ostrcat(send, tmppath, 1, 0);
     
    7878        debug(99, "tmpstr: %s", tmpstr);
    7979        titheklog(debuglevel, "/tmp/divxstage1_get", NULL, NULL, NULL, tmpstr);
     80*/
     81        tmpstr = gethttps(tmplink, NULL, NULL, NULL, NULL, tmplink, 1);
     82        titheklog(debuglevel, "/tmp/divxstage1_get", NULL, NULL, NULL, tmpstr);
    8083
    8184        if(ostrstr(tmpstr, "The file is being transfered to our other servers. This may take few minutes.") != NULL)
     
    8588        }
    8689
    87         file = string_resub("flashvars.file=\"", "\";", tmpstr, 0);
    88         if(file == NULL)
    89                 file = string_replace("/video/", "", tmppath, 0);
    90         if(file == NULL)
    91                 file = string_resub("login.php?return=/video/", "\">Log In", tmpstr, 0);
    92         if(file == NULL)
    93                 file = string_resub("<a href=\"/share.php?id=", "&title=", tmpstr, 0);
    94        
    95         char* r1 = NULL, *r2 = NULL, *r3 = NULL, *r4 = NULL;
    96         pos = ostrstr(tmpstr, ");}('");
    97         if(pos != NULL)
    98         {
    99                 r1 = string_resub(");}('", "'", pos, 0);
    100                 pos = ostrstr(pos + 5, ",'");
     90char* stepkey = NULL;
     91char* submit = NULL;
     92char* post = NULL;
     93char* tmpstr2 = NULL;
     94
     95        stepkey = string_resub("name=\"stepkey\" value=\"", "\"", tmpstr, 0);
     96        submit = string_resub("name=\"submit\" onclick=\"lads();\" class=\"btn\" value=\"", "\"", tmpstr, 0);
     97        post = ostrcat("stepkey=", stepkey, 0, 0);
     98        post = ostrcat(post, "&submit=", 1, 0);
     99        post = ostrcat(post, submit, 1, 0);
     100
     101        printf("post: %s\n", post);
     102
     103        tmpstr = gethttps(tmplink, NULL, post, NULL, NULL, tmplink, 1);
     104        titheklog(debuglevel, "/tmp/divxstage2_post", NULL, NULL, NULL, tmpstr);
     105
     106        tmpstr2 = string_resub("<div id=\"flaAspectRatio\">", "</div>", tmpstr, 0);
     107        streamlink = oregex(".*(http.*.mp4).*", tmpstr2);
     108        streamlink = stringreplacechar(streamlink, '"', '\0');
     109        if(streamlink == NULL)
     110        {
     111                file = string_resub("flashvars.file=\"", "\";", tmpstr, 0);
     112                if(file == NULL)
     113                        file = string_replace("/video/", "", tmppath, 0);
     114                if(file == NULL)
     115                        file = string_resub("login.php?return=/video/", "\">Log In", tmpstr, 0);
     116                if(file == NULL)
     117                        file = string_resub("<a href=\"/share.php?id=", "&title=", tmpstr, 0);
     118               
     119                char* r1 = NULL, *r2 = NULL, *r3 = NULL, *r4 = NULL;
     120                pos = ostrstr(tmpstr, ");}('");
    101121                if(pos != NULL)
    102122                {
    103                         r2 = string_resub(",'", "'", pos, 0);
    104                         pos = ostrstr(pos + 2, ",'");
     123                        r1 = string_resub(");}('", "'", pos, 0);
     124                        pos = ostrstr(pos + 5, ",'");
    105125                        if(pos != NULL)
    106126                        {
    107                                 r3 = string_resub(",'", "'", pos, 0);
     127                                r2 = string_resub(",'", "'", pos, 0);
    108128                                pos = ostrstr(pos + 2, ",'");
    109129                                if(pos != NULL)
    110                                         r4 = string_resub(",'", "'", pos, 0);
     130                                {
     131                                        r3 = string_resub(",'", "'", pos, 0);
     132                                        pos = ostrstr(pos + 2, ",'");
     133                                        if(pos != NULL)
     134                                                r4 = string_resub(",'", "'", pos, 0);
     135                                }
    111136                        }
    112137                }
    113         }
    114        
    115         filekey = getfilekey(r1, r2, r3, r4);
    116        
    117         free(r1); r1 = NULL;
    118         free(r2); r2 = NULL;
    119         free(r3); r3 = NULL;
    120         free(r4); r4 = NULL;
    121        
    122         if(filekey == NULL)
    123                 filekey = string_resub("flashvars.filekey=\"", "\";", tmpstr, 0);
    124 
    125         if(filekey == NULL)
    126         {
    127                 char* searchstr = string_resub("flashvars.filekey=", ";", tmpstr, 0);
    128                 debug(99, "searchstr: %s", searchstr);
    129                 searchstr = ostrcat(searchstr, "=\"", 1, 0);
    130                 filekey = string_resub(searchstr, "\";", tmpstr, 0);
    131         }
    132         debug(99, "filekey: %s", filekey);
    133 
    134 
    135         free(tmppath), tmppath = NULL;
    136         tmppath = ostrcat("/api/player.api.php?file=", file, 0, 0);
    137         tmppath = ostrcat(tmppath, "&key=", 1, 0);
    138         tmppath = ostrcat(tmppath, filekey, 1, 0);
    139 
    140         free(send), send = NULL;
    141         send = ostrcat(send, "GET ", 1, 0);
    142         send = ostrcat(send, tmppath, 1, 0);
    143         send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);
    144         send = ostrcat(send, tmphost, 1, 0);
    145         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);
    146         debug(99, "send: %s", send);
    147         free(tmpstr), tmpstr = NULL;
    148         tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
    149         debug(99, "tmpstr: %s", tmpstr);
    150         titheklog(debuglevel, "/tmp/divxstage2_get", NULL, NULL, NULL, tmpstr);
    151 
    152         if(tmpstr == NULL)
    153         {
    154                 textbox(_("Message"), _("The page is temporarily unavailable") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
    155                 goto end;
    156         }
    157 
    158         if(ostrstr(tmpstr, "404 - Not Found") != NULL)
    159         {
    160                 textbox(_("Message"), _("The video no longer exists") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
    161                 goto end;
    162         }
    163 
    164         streamlink = string_resub("url=", "&", tmpstr, 0);
    165         debug(99, "streamlink1: %s", streamlink);
    166         htmldecode(streamlink, streamlink);
    167         debug(99, "streamlink2: %s", streamlink);
    168        
     138               
     139                filekey = getfilekey(r1, r2, r3, r4);
     140               
     141                free(r1); r1 = NULL;
     142                free(r2); r2 = NULL;
     143                free(r3); r3 = NULL;
     144                free(r4); r4 = NULL;
     145               
     146                if(filekey == NULL)
     147                        filekey = string_resub("flashvars.filekey=\"", "\";", tmpstr, 0);
     148       
     149                if(filekey == NULL)
     150                {
     151                        char* searchstr = string_resub("flashvars.filekey=", ";", tmpstr, 0);
     152                        debug(99, "searchstr: %s", searchstr);
     153                        searchstr = ostrcat(searchstr, "=\"", 1, 0);
     154                        filekey = string_resub(searchstr, "\";", tmpstr, 0);
     155                }
     156                debug(99, "filekey: %s", filekey);
     157       
     158       
     159                free(tmppath), tmppath = NULL;
     160                tmppath = ostrcat("/api/player.api.php?file=", file, 0, 0);
     161                tmppath = ostrcat(tmppath, "&key=", 1, 0);
     162                tmppath = ostrcat(tmppath, filekey, 1, 0);
     163       
     164                free(send), send = NULL;
     165                send = ostrcat(send, "GET ", 1, 0);
     166                send = ostrcat(send, tmppath, 1, 0);
     167                send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);
     168                send = ostrcat(send, tmphost, 1, 0);
     169                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);
     170                debug(99, "send: %s", send);
     171                free(tmpstr), tmpstr = NULL;
     172                tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
     173                debug(99, "tmpstr: %s", tmpstr);
     174                titheklog(debuglevel, "/tmp/divxstage2_get", NULL, NULL, NULL, tmpstr);
     175       
     176                if(tmpstr == NULL)
     177                {
     178                        textbox(_("Message"), _("The page is temporarily unavailable") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
     179                        goto end;
     180                }
     181       
     182                if(ostrstr(tmpstr, "404 - Not Found") != NULL)
     183                {
     184                        textbox(_("Message"), _("The video no longer exists") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
     185                        goto end;
     186                }
     187       
     188                streamlink = string_resub("url=", "&", tmpstr, 0);
     189                debug(99, "streamlink1: %s", streamlink);
     190                htmldecode(streamlink, streamlink);
     191                debug(99, "streamlink2: %s", streamlink);
     192                titheklog(debuglevel, "/tmp/divxstage4_streamlink", NULL, NULL, NULL, tmpstr);
     193        }
     194        else
     195                titheklog(debuglevel, "/tmp/divxstage4_streamlink", NULL, NULL, NULL, tmpstr);
     196
    169197end:
    170198        free(tmphost); tmphost = NULL;
    171199        free(tmppath); tmppath = NULL;
    172200        free(tmpstr); tmpstr = NULL;
     201        free(tmpstr2); tmpstr2 = NULL;
    173202        free(send); send = NULL;
    174203        free(filekey); filekey = NULL;
Note: See TracChangeset for help on using the changeset viewer.