how to get the list of videos from a user on youtube

2

Hello I was trying to get the list of my videos not to do it manually. I read in an article they did on a simple way to do it. the thread is:

  

link

I start the code but it shows nothing.

The code:

<html>
<script>
// Get Uploads Playlist
$.get(
   "https://www.googleapis.com/youtube/v3/channels",{
   part : 'contentDetails', 
   forUsername : 'USER_CHANNEL_NAME',
   key: 'YOUR_API_KEY'},
   function(data) {
      $.each( data.items, function( i, item ) {
          pid = item.contentDetails.relatedPlaylists.uploads;
          getVids(pid);
      });
  }
);

//Get Videos
function getVids(pid){
    $.get(
        "https://www.googleapis.com/youtube/v3/playlistItems",{
        part : 'snippet', 
        maxResults : 20,
        playlistId : pid,
        key: 'YOUR_API_KEY'},
        function(data) {
            var results;
            $.each( data.items, function( i, item ) {
                results = '<li>'+ item.snippet.title +'</li>';
                $('#results').append(results);
            });
        }
    );
}

</script>
<!--In your HTML -->
<ul id="results"></ul>
</html>

How could I do it to get the list of videos and save it in my file or add them and then show them.

    
asked by Sergio Ramos 12.02.2018 в 02:40
source

0 answers