Changeset 32877


Ignore:
Timestamp:
02/05/15 19:30:01 (9 years ago)
Author:
obi
Message:

youtube fix and optimize searching

File:
1 edited

Legend:

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

    r29555 r32877  
    261261                                       
    262262                char* tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0);
     263//              writesys("/var/usr/local/share/titan/plugins/tithek/tmpstr1", tmpstr, 0);
     264
    263265                tmpstr = string_replace_all("media:thumbnail", "\nthumbnail", tmpstr, 1);
     266//              writesys("/var/usr/local/share/titan/plugins/tithek/tmpstr2", tmpstr, 0);
    264267
    265268                int count = 0;
     
    274277                        for(i = 0; i < max; i++)
    275278                        {
     279                                debug(99, "ret1[i].part=%s", ret1[i].part);
    276280                                if(ostrstr(ret1[i].part, "http://i.ytimg.com/vi/") != NULL)
    277281                                {
    278                                         pic = oregex(".*thumbnail url=\'(http://i.ytimg.com/vi/.*/0.jpg).*", ret1[i].part);
    279                                         id = oregex(".*thumbnail url=\'http://i.ytimg.com/vi/(.*)/0.jpg.*", ret1[i].part);
     282                                        pic = oregex(".*thumbnail url=\'(http://i.ytimg.com/vi/.*/.*.jpg).*media:title.*", ret1[i].part);
     283                                        id = oregex(".*thumbnail url=\'http://i.ytimg.com/vi/(.*)/.*.jpg.*media:title.*", ret1[i].part);
     284                                        title = oregex(".*<media:title type='plain'>(.*)</media:title>.*", ret1[i].part);
     285
     286                                        debug(99, "title=%s", title);
     287                                        debug(99, "id=%s", id);
     288                                        debug(99, "pic=%s", pic);
     289
    280290                                        int rcret = waitrc(NULL, 10, 0);
    281291                                        if(rcret == getrcconfigint("rcexit", NULL)) break;
     
    286296                                                ip = ostrcat("www.youtube.com", NULL, 0, 0);
    287297                                                path = ostrcat("watch?v=", id, 0, 0);
    288                                                 title = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0);
    289                                                 title = string_resub("<meta name=\"title\" content=\"", "\">", title, 0);
    290298
    291299                                                line = ostrcat(line, title, 1, 0);
    292 //                                                                              line = ostrcat(line, "#http://www.youtube.com/watch?v=", 1, 0);
    293300                                                line = ostrcat(line, "#http://www.youtube.com/get_video_info?&video_id=", 1, 0);
    294301                                                line = ostrcat(line, id, 1, 0);
Note: See TracChangeset for help on using the changeset viewer.