Changeset 35785 for titan/plugins


Ignore:
Timestamp:
09/28/15 18:56:44 (9 years ago)
Author:
obi
Message:

[tithek] youtube fix search step 1

File:
1 edited

Legend:

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

    r34510 r35785  
    4545*/
    4646
    47 // ssl workaround
    48                 unlink("/tmp/.youtube.cache");
    49                 char* cmd = NULL;
    50                 cmd = ostrcat("wget --no-check-certificate \"http://", ip, 0, 0);
    51                 cmd = ostrcat(cmd, "/", 1, 0);
    52                 cmd = ostrcat(cmd, tmppath, 1, 0);
    53                 cmd = ostrcat(cmd, "\" -O /tmp/.youtube.cache", 1, 0);
    54                 debug(99, "cmd: %s", cmd);
    55                 system(cmd);
    56                 free(cmd), cmd = NULL;
    57                 tmpstr = command("cat /tmp/.solar.cache");
    58                 debug(99, "tmpstr: %s", tmpstr);
    59 // ssl workaround end
    60 //      tmpstr = gethttp(ip, tmppath, 80, NULL, NULL, 10000, NULL, 0);
     47        tmpstr = gethttps(link, NULL, NULL, NULL, NULL, 1);
    6148        writesys("/var/usr/local/share/titan/plugins/tithek/youtube_tmpstr", tmpstr, 0);
    6249
     
    272259                else if(((struct tithek*)listbox->select->handle)->flag == 11)
    273260                        path = ostrcat(path, "&max-results=50", 1, 0);
    274                                        
    275                 char* tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0);
    276 //              writesys("/var/usr/local/share/titan/plugins/tithek/tmpstr1", tmpstr, 0);
     261
     262
     263                char* url = NULL;
     264                url = ostrcat("https://www.googleapis.com/youtube/v3/search?q=", search, 0, 0);
     265                url = ostrcat(url, "&regionCode=US&part=snippet&hl=en_US&key=AIzaSyBAdxZCHbeJwnQ7dDZQJNfcaF46MdqJ24E&type=video&maxResults=50", 1, 0);
     266
     267//12:39:28 T:11340  NOTICE: 'GET /youtube/v3/search?q=pink&regionCode=US&part=snippet&hl=en_US&key=AIzaSyBAdxZCHbeJwnQ7dDZQJNfcaF46MdqJ24E&type=video&maxResults=50 HTTP/1.1\r\nHost: www.googleapis.com\r\nUser-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.36 Safari/537.36\r\nConnection: close\r\nAccept-Encoding: gzip, deflate\r\n\r\n'
     268
     269                char* tmpstr = NULL;
     270                tmpstr = gethttps(url, NULL, NULL, NULL, NULL, 1);             
     271//              tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0);
     272                writesys("/var/usr/local/share/titan/plugins/tithek/tmpstr1", tmpstr, 0);
     273printf("ALLE\n");
     274
     275                tmpstr = stringreplacechar(tmpstr, '\n', ' ');
     276
     277                tmpstr = string_replace_all("\"etag\":", "\n\"etag\":", tmpstr, 1);
    277278
    278279                tmpstr = string_replace_all("media:thumbnail", "\nthumbnail", tmpstr, 1);
    279 //              writesys("/var/usr/local/share/titan/plugins/tithek/tmpstr2", tmpstr, 0);
    280 
     280                writesys("/var/usr/local/share/titan/plugins/tithek/tmpstr2", tmpstr, 0);
     281/*
     282
     283//12:39:28 T:11340  NOTICE: 'GET /youtube/v3/videos?part=snippet%2CcontentDetails&id=eOxPED0TunI%2CsojYfBmdvlE%2Cj-ocHL0eudY%2CHQBia-CfqbE%2CmHLwXQoG4CU%2Cw5VFOKKAbQQ%2CvnoQ5lkBVhU%2CeocCPDxKq1o%2ChSjIz8oQuko%2CJDKGWaCglRM%2CbZsqdTrr1eM%2CyTCDVfMz15M%2CHq2DINl2MxI%2CnB2Hsh1XqyA%2C41aGCrXM20E%2Cuc8OpUnUNNU%2Cv4UkD7U88NQ%2CAlMa52Xkoj0%2CocDlOD1Hw9k%2CG6ZLZQGydPc%2CxXvBkwihOE8%2CNJWIbIe0N90%2CwCqs2uJWwZs%2CPl-TCZSRhy4%2C0TDTEEXZtLs%2CXIId4uESVeA%2ClHSl-yz5FqA%2CRzriJpYiGjw%2CjT5RwB5ML30%2C5r9vdqAFCY4%2CzsmUOdmm02A%2C8WmZW7JB3GY%2C3NrNWISh5CE%2CeDtMxamBxI8%2CBR4yQFZK9YM%2CRAcNZo7-f0g%2CXjVNlG5cZyQ%2CasaCQOZpqUQ%2CWWYLM9opelw%2CqOfkpu6749w%2CBJLWNWDqK-k%2COpQFFLBMEPI%2Cm-6ir-gFpbA%2C3stsDXki__U%2C57KVfhWcEk0%2CFJfFZqTlWrQ%2CSNjFTxaeWug%2CumM9Ls0SaiU%2Cw7JRWHCKkIY%2C6lyq05OWuVM&key=AIzaSyBAdxZCHbeJwnQ7dDZQJNfcaF46MdqJ24E HTTP/1.1\r\nHost: www.googleapis.com\r\nUser-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.36 Safari/537.36\r\nConnection: close\r\nAccept-Encoding: gzip, deflate\r\n\r\n'
     284/youtube/v3/videos?part=snippet%2CcontentDetails
     285&id=
     286eOxPED0TunI
     287%2
     288CsojYfBmdvlE
     289%2
     290Cj-ocHL0eudY
     291%2
     292CHQBia-CfqbE
     293%2
     294CmHLwXQoG4CU
     295%2
     296Cw5VFOKKAbQQ%2CvnoQ5lkBVhU%2CeocCPDxKq1o%2ChSjIz8oQuko%2CJDKGWaCglRM%2CbZsqdTrr1eM%2CyTCDVfMz15M%2CHq2DINl2MxI%2CnB2Hsh1XqyA
     297%2C41aGCrXM20E%2Cuc8OpUnUNNU%2Cv4UkD7U88NQ%2CAlMa52Xkoj0%2CocDlOD1Hw9k%2CG6ZLZQGydPc%2CxXvBkwihOE8%2CNJWIbIe0N90%2CwCqs2uJWwZs%2CPl-TCZSRhy4
     298%2C0TDTEEXZtLs%2CXIId4uESVeA%2ClHSl-yz5FqA%2CRzriJpYiGjw%2CjT5RwB5ML30%2C5r9vdqAFCY4%2CzsmUOdmm02A%2C8WmZW7JB3GY%2C3NrNWISh5CE%2CeDtMxamBxI8
     299%2CBR4yQFZK9YM%2CRAcNZo7-f0g%2CXjVNlG5cZyQ%2CasaCQOZpqUQ%2CWWYLM9opelw%2CqOfkpu6749w%2CBJLWNWDqK-k
     300%2COpQFFLBMEPI%2Cm-6ir-gFpbA
     301%2C3stsDXki__U%2C57KVfhWcEk0%2CFJfFZqTlWrQ%2CSNjFTxaeWug%2CumM9Ls0SaiU%2Cw7JRWHCKkIY%2C6lyq05OWuVM
     302
     303&key=AIzaSyBAdxZCHbeJwnQ7dDZQJNfcaF46MdqJ24E HTTP/1.1\r\nHost: www.googleapis.com\r\nUser-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.36 Safari/537.36\r\nConnection: close\r\nAccept-Encoding: gzip, deflate\r\n\r\n'
     304
     305"title": "
     306"videoId": "
     307"url": "
     308*/
    281309                int count = 0;
    282310                int incount = 0;
     
    284312                struct splitstr* ret1 = NULL;
    285313                ret1 = strsplit(tmpstr, "\n", &count);
     314//part="etag": "\"jOXstHOM20qemPbHbyzf7ztZ7rI/zJExHKkQXAGmI7-mKIkjbmndgJ0\"",    "id": {     "kind": "youtube#video",     "videoId": "57KVfhWcEk0"    },    "snippet": {     "publishedAt": "2015-09-19T02:06:39.000Z",     "channelId": "UCwehWhlhepFE8mFdlC1ebAw",     "title": "Pink - Mindless Self Indulgence FULL ALBUM",     "description": "JIMMY SAYS TO BUY THE FUCKING ALBUM Tracklist: 01. Personal Jesus 02. This Hurts 03. Be Like Superman 04. Memory Of Heaven 05. Vanity 06. Married ...",     "thumbnails": {      "default": {       "url": "https://i.ytimg.com/vi/57KVfhWcEk0/default.jpg"      },      "medium": {       "url": "https://i.ytimg.com/vi/57KVfhWcEk0/mqdefault.jpg"      },      "high": {       "url": "https://i.ytimg.com/vi/57KVfhWcEk0/hqdefault.jpg"      }     },     "channelTitle": "",     "liveBroadcastContent": "none"    }   }  ] }
    286315
    287316                if(ret1 != NULL)
     
    291320                        {
    292321                                debug(99, "ret1[i].part=%s", ret1[i].part);
    293                                 if(ostrstr(ret1[i].part, "http://i.ytimg.com/vi/") != NULL)
     322                                if(ostrstr(ret1[i].part, "videoId") != NULL)
    294323                                {
    295                                         pic = oregex(".*thumbnail url=\'(http://i.ytimg.com/vi/.*/.*.jpg).*media:title.*", ret1[i].part);
    296                                         id = oregex(".*thumbnail url=\'http://i.ytimg.com/vi/(.*)/.*.jpg.*media:title.*", ret1[i].part);
    297                                         title = oregex(".*<media:title type='plain'>(.*)</media:title>.*", ret1[i].part);
     324                                        pic = string_resub("\"url\": \"", "\"", ret1[i].part, 0);
     325                                        id = string_resub("\"videoId\": \"", "\"", ret1[i].part, 0);
     326                                        title = string_resub("\"title\": \"", "\"", ret1[i].part, 0);
    298327
    299328                                        debug(99, "title=%s", title);
     
    311340
    312341                                                line = ostrcat(line, title, 1, 0);
    313                                                 line = ostrcat(line, "#http://www.youtube.com/get_video_info?&video_id=", 1, 0);
     342                                                line = ostrcat(line, "#http://www.youtube.com/get_video_info?el=leanback&cplayer=UNIPLAYER&cos=Windows&height=1080&cbr=Chrome&hl=en_US&cver=4&ps=leanback&c=TVHTML5&video_id=", 1, 0);
    314343                                                line = ostrcat(line, id, 1, 0);
     344                                                line = ostrcat(line, "&cbrver=40.0.2214.115&width=1920&cosver=6.1&ssl_stream=1", 1, 0);
    315345                                                line = ostrcat(line, "#", 1, 0);
    316346                                                line = ostrcat(line, pic, 1, 0);
Note: See TracChangeset for help on using the changeset viewer.