Changeset 38774


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

tithek fix nowvideo

File:
1 edited

Legend:

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

    r37484 r38774  
    99        char* tmppath = NULL;
    1010        char* tmpstr = NULL;
     11        char* tmpstr2 = NULL;
    1112        char* send = NULL;
    1213        char* ip = NULL;
     
    108109        }
    109110
    110         file = string_resub("flashvars.file=\"", "\";", tmpstr, 0);
    111         if(file == NULL)
    112                 file = string_replace("/video/", "", tmppath, 0);
    113         if(file == NULL)
    114                 file = string_resub("login.php?return=/video/", "\">Log In", tmpstr, 0);
    115         if(file == NULL)
    116                 file = string_resub("<a href=\"/share.php?id=", "&title=", tmpstr, 0);
    117        
    118         char* r1 = NULL, *r2 = NULL, *r3 = NULL, *r4 = NULL;
    119         pos = ostrstr(tmpstr, ");}('");
    120         if(pos != NULL)
     111        tmpstr2 = string_resub("<div id=\"flaAspectRatio\">", "</div>", tmpstr, 0);
     112        streamlink = oregex(".*(http.*.mp4).*", tmpstr2);
     113        streamlink = stringreplacechar(streamlink, '"', '\0');
     114        if(streamlink == NULL)
    121115        {
    122                 r1 = string_resub(");}('", "'", pos, 0);
    123                 pos = ostrstr(pos + 5, ",'");
     116                file = string_resub("flashvars.file=\"", "\";", tmpstr, 0);
     117                if(file == NULL)
     118                        file = string_replace("/video/", "", tmppath, 0);
     119                if(file == NULL)
     120                        file = string_resub("login.php?return=/video/", "\">Log In", tmpstr, 0);
     121                if(file == NULL)
     122                        file = string_resub("<a href=\"/share.php?id=", "&title=", tmpstr, 0);
     123               
     124                char* r1 = NULL, *r2 = NULL, *r3 = NULL, *r4 = NULL;
     125                pos = ostrstr(tmpstr, ");}('");
    124126                if(pos != NULL)
    125127                {
    126                         r2 = string_resub(",'", "'", pos, 0);
    127                         pos = ostrstr(pos + 2, ",'");
     128                        r1 = string_resub(");}('", "'", pos, 0);
     129                        pos = ostrstr(pos + 5, ",'");
    128130                        if(pos != NULL)
    129131                        {
    130                                 r3 = string_resub(",'", "'", pos, 0);
     132                                r2 = string_resub(",'", "'", pos, 0);
    131133                                pos = ostrstr(pos + 2, ",'");
    132134                                if(pos != NULL)
    133                                         r4 = string_resub(",'", "'", pos, 0);
     135                                {
     136                                        r3 = string_resub(",'", "'", pos, 0);
     137                                        pos = ostrstr(pos + 2, ",'");
     138                                        if(pos != NULL)
     139                                                r4 = string_resub(",'", "'", pos, 0);
     140                                }
    134141                        }
    135142                }
     143               
     144                filekey = getfilekey(r1, r2, r3, r4);
     145               
     146                free(r1); r1 = NULL;
     147                free(r2); r2 = NULL;
     148                free(r3); r3 = NULL;
     149                free(r4); r4 = NULL;
     150               
     151                if(filekey == NULL)
     152                        filekey = string_resub("flashvars.filekey=\"", "\";", tmpstr, 0);
     153       
     154                if(filekey == NULL)
     155                {
     156                        char* searchstr = string_resub("flashvars.filekey=", ";", tmpstr, 0);
     157                        debug(99, "searchstr: %s", searchstr);
     158                        searchstr = ostrcat(searchstr, "=\"", 1, 0);
     159                        filekey = string_resub(searchstr, "\";", tmpstr, 0);
     160                }
     161                debug(99, "filekey: %s", filekey);
     162       
     163                free(tmppath), tmppath = NULL;
     164                tmppath = ostrcat("/api/player.api.php?file=", file, 0, 0);
     165                tmppath = ostrcat(tmppath, "&key=", 1, 0);
     166                tmppath = ostrcat(tmppath, filekey, 1, 0);
     167       
     168                free(send), send = NULL;
     169                send = ostrcat(send, "GET ", 1, 0);
     170                send = ostrcat(send, tmppath, 1, 0);
     171                send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);
     172                send = ostrcat(send, tmphost, 1, 0);
     173                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);
     174                debug(99, "send: %s", send);
     175                free(tmpstr), tmpstr = NULL;
     176                tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
     177                debug(99, "tmpstr: %s", tmpstr);
     178                titheklog(debuglevel, "/tmp/nowvideo2_get", NULL, NULL, NULL, tmpstr);
     179       
     180                streamlink = string_resub("url=", "&", tmpstr, 0);
    136181        }
    137        
    138         filekey = getfilekey(r1, r2, r3, r4);
    139        
    140         free(r1); r1 = NULL;
    141         free(r2); r2 = NULL;
    142         free(r3); r3 = NULL;
    143         free(r4); r4 = NULL;
    144        
    145         if(filekey == NULL)
    146                 filekey = string_resub("flashvars.filekey=\"", "\";", tmpstr, 0);
     182        else
     183                titheklog(debuglevel, "/tmp/nowvideo2_get", NULL, NULL, NULL, tmpstr);
    147184
    148         if(filekey == NULL)
    149         {
    150                 char* searchstr = string_resub("flashvars.filekey=", ";", tmpstr, 0);
    151                 debug(99, "searchstr: %s", searchstr);
    152                 searchstr = ostrcat(searchstr, "=\"", 1, 0);
    153                 filekey = string_resub(searchstr, "\";", tmpstr, 0);
    154         }
    155         debug(99, "filekey: %s", filekey);
    156 
    157         free(tmppath), tmppath = NULL;
    158         tmppath = ostrcat("/api/player.api.php?file=", file, 0, 0);
    159         tmppath = ostrcat(tmppath, "&key=", 1, 0);
    160         tmppath = ostrcat(tmppath, filekey, 1, 0);
    161 
    162         free(send), send = NULL;
    163         send = ostrcat(send, "GET ", 1, 0);
    164         send = ostrcat(send, tmppath, 1, 0);
    165         send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);
    166         send = ostrcat(send, tmphost, 1, 0);
    167         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);
    168         debug(99, "send: %s", send);
    169         free(tmpstr), tmpstr = NULL;
    170         tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
    171         debug(99, "tmpstr: %s", tmpstr);
    172         titheklog(debuglevel, "/tmp/nowvideo2_get", NULL, NULL, NULL, tmpstr);
    173 
    174         streamlink = string_resub("url=", "&", tmpstr, 0);
    175185end:
    176186        free(tmphost); tmphost = NULL;
    177187        free(tmppath); tmppath = NULL;
    178188        free(tmpstr); tmpstr = NULL;
     189        free(tmpstr2); tmpstr2 = NULL;
    179190        free(send); send = NULL;
    180191        free(filekey); filekey = NULL;
Note: See TracChangeset for help on using the changeset viewer.