•  


api-samples/javascript at 9e0a102355ea427655a4beafc3b666c7cc5b5b3d · youtube/api-samples · GitHub
Skip to content

Latest commit

 

History

History

javascript

Samples in this directory:

Description: The auth.js script demonstrates how to use the Google APIs Client Library for JavaScript to provide API access and authorize user requests. All of the subsequent samples on this page use this script to authorize their requests.

For requests that do not require authentication, you could also use the key query parameter to specify an API key rather than using OAuth 2.0.

Note: You need to update the client ID in the auth.js file. You can obtain your own client ID by registering your application in the Google Developers Console .

Method: youtube.videos.insert Description: This code sample demonstrates how to execute a resumable upload using XHR/CORS.

Method: youtube.playlists.insert
Description: This JavaScript code creates a private playlist and adds videos to that playlist. (You could, of course, modify the code so that it creates a publicly visible playlist or so that it checks a form value to determine whether the playlist is public or private.) Note that you need to update the client ID in the auth.js file to run this code.

The HTML page uses JQuery, along with the auth.js and playlist_updates.js JavaScript files, to display a simple form for adding videos to the playlist.

Method: youtube.playlistItems.list
Description: The JavaScript sample code performs the following functions:

  1. It retrieves the playlist ID for videos uploaded to the user's channel using the API's channels.list method. This API call also sets the mine parameter to true to retrieve channel information for the authorizing user.
  2. It passes that ID to the playlistItems.list method to retrieve the videos in that list.
  3. It displays the list of videos.
  4. It constructs next and previous page buttons and sets their visibility based on the information in the API response.

The HTML page uses JQuery, the auth.js and my_uploads.js JavaScript files, and a CSS file to display the list of uploaded videos.

Method: youtube.search.list
Description: This code sample calls the API's search.list method to retrieve search results associated with a particular keyword. The HTML page uses JQuery, along with the auth.js and search.js JavaScript files, to show a simple search form and display the list of search results.

Method: youtube.videos.insert
Description: This JavaScript sample performs the following functions:

  1. It retrieves the channel name and thumbnail of the authenticated user's channel using the API's channels.list method.
  2. It handles the video upload to YouTube using the resumable upload protocol.
  3. It polls for the uploaded video's upload and processing status using the API's videos.list method by setting the part parameter value to status.

The HTML page uses JQuery, the cors_upload.js and upload_video.js JavaScript files, and the upload_video.css file to upload a video file to YouTube.

Note that if you use this code in your own application, you must replace the value of the data-clientid attribute in the code for the Sign-In Button with your project's client ID. The only valid JavaScript origin for the client ID in the sample code is http://localhost . This means that you could test the sample locally, but it would not work in your production application.

Method: youtubeAnalytics.reports.query
Description: This sample uses the YouTube Data and YouTube Analytics APIs to retrieve YouTube channel metrics. The samples use the Google APIs JavaScript client library to demonstrate API functionality. The Building a Sample Application document walks you through the steps of building this application and discusses different portions of this code in more detail.

In addition to the JavaScript file described above, the HTML page uses jQuery , which provides helper methods to simplify HTML document traversing, event handling, animating and Ajax interactions. It also uses the Google API loader ( www.google.com/jsapi ), which lets you easily import one or more Google APIs. This example uses the API loader to load the Google Visualization API, which is used to chart the retrieved Analytics data. Finally, the Google APIs Client Library for JavaScript helps you to implement OAuth 2.0 authentication and to call the YouTube Analytics API.

- "漢字路" 한글한자자동변환 서비스는 교육부 고전문헌국역지원사업의 지원으로 구축되었습니다.
- "漢字路" 한글한자자동변환 서비스는 전통문화연구회 "울산대학교한국어처리연구실 옥철영(IT융합전공)교수팀"에서 개발한 한글한자자동변환기를 바탕하여 지속적으로 공동 연구 개발하고 있는 서비스입니다.
- 현재 고유명사(인명, 지명등)을 비롯한 여러 변환오류가 있으며 이를 해결하고자 많은 연구 개발을 진행하고자 하고 있습니다. 이를 인지하시고 다른 곳에서 인용시 한자 변환 결과를 한번 더 검토하시고 사용해 주시기 바랍니다.
- 변환오류 및 건의,문의사항은 juntong@juntong.or.kr로 메일로 보내주시면 감사하겠습니다. .
Copyright ⓒ 2020 By '전통문화연구회(傳統文化硏究會)' All Rights reserved.
 한국   대만   중국   일본