youtube api v3 search by keyword javascript

后端 未结 3 1832
眼角桃花
眼角桃花 2021-01-16 12:16

The javascript example for \"search by keyword\" that is given at the google developers page isn\'t working for me. https://developers.google.com/youtube/v3/code_samples/ja

3条回答
  •  感情败类
    2021-01-16 12:54

    Thank you for your coding. Let me share my code:

    function makeRequest(){
          var q = $('#query').val();
          var request = gapi.client.youtube.search.list({
              q: q,
              part: 'snippet'                        
          });
          request.execute(function(response){
              var str = JSON.stringify(response.result,'',4);
              $('#search-container').val( str);
              makeControl(response);
          });
      }
      
      function makeControl(resp){
          var stList = ''; 
          for (var i=0; i'+
                    ''+
                    '';
              }
          }
          document.getElementById('list1').innerHTML = stList + '
    '+i+'-'+ tit +'
    '; //HTML:
    //
    } function playVid(thi){ var st = 'https://www.youtube.com/embed/'+thi.title+'?autoplay=1'; document.getElementById('player').src = st; //HTML: }

提交回复
热议问题