אנחנו מעדכנים את Data API כך שיתאים לאופן שבו YouTube סופר צפיות ב-Shorts.
מידע נוסף
דוגמאות קוד של YouTube Data API (v3)
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
בדף תרחישים לדוגמה ודוגמאות קוד תוכלו למצוא תרחישים נפוצים לשימוש ב-YouTube Data API וב-YouTube Live Streaming API.
בדף הזה אפשר לבחור משאב API ושיטה, ולאחר מכן יוצגו תרחישים נפוצים לדוגמה של השיטה הזו. לאחר מכן אפשר ללחוץ על תרחיש לדוגמה כדי לאכלס את הווידג'ט של APIs Explorer בערכים לדוגמה של פרמטרים ומאפיינים לתרחיש לדוגמה הזה. אפשר גם לפתוח את הווידג'ט של APIs Explorer במסך מלא כדי לראות דוגמאות קוד שפועלות ב-Java, JavaScript, PHP ו-Python. אם מעדכנים את ערכי הפרמטרים או המאפיינים ב-API Explorer, גם דוגמאות הקוד מתעדכנות כך שישקפו את השינויים.
בקטע הבא מפורטות דוגמאות קוד בשפות אחרות.
קטעי קוד עצמאיים
ברשימה הבאה מפורטות דוגמאות לקוד שזמינות ל-YouTube Data API (גרסה 3) בשפות שאינן Java, JavaScript, PHP ו-Python. כפי שצוין בקטע הקודם, דוגמאות הקוד לשפות האלה זמינות בדף מקרים לדוגמה ודוגמאות קוד.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-08-21 (שעון UTC).
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-08-21 (שעון UTC)."],[[["\u003cp\u003eExplore the use cases and code samples page to find examples for the YouTube Data API and YouTube Live Streaming API.\u003c/p\u003e\n"],["\u003cp\u003eThe use cases and code samples page provides interactive samples in Java, JavaScript, PHP, and Python, allowing you to adjust parameters and see updated code.\u003c/p\u003e\n"],["\u003cp\u003eStandalone code snippets are available for Apps Script, Go, .NET, and Ruby, demonstrating common methods like uploading videos, searching for videos, and managing playlists.\u003c/p\u003e\n"],["\u003cp\u003eThe page provides code samples for several common methods including subscriptions.insert, channels.list, search.list, and videos.update, allowing developers to find quick snippets for their use cases.\u003c/p\u003e\n"],["\u003cp\u003eCode samples are provided for various common tasks such as authorization, uploading, and searching for videos, as well as creating playlists and subscriptions.\u003c/p\u003e\n"]]],["The document details code samples for the YouTube Data API and YouTube Live Streaming API. Users can find examples for common use cases by selecting an API resource and method. The APIs Explorer widget allows interaction with samples, including parameter adjustments, with working code in Java, JavaScript, PHP, and Python. Additional code snippets are available in Apps Script, Go, .NET, and Ruby, covering actions like subscribing to channels, retrieving uploads, searching videos, updating videos, and creating playlists.\n"],null,["# YouTube Data API (v3) Code Samples\n\nYou can explore common use cases for the YouTube Data API and YouTube Live Streaming API on the [use cases and code samples](/youtube/v3/code_samples/code_snippets) page.\n\nThe page lets you select an API resource and method and then lists common use cases for that method. You can then click on any use case to populate the APIs Explorer widget with sample parameter and property values for that use case. You can also open the fullscreen APIs Explorer widget to see working code samples for Java, JavaScript, PHP, and Python. If you update parameter or property values in the APIs Explorer, the code samples also update to reflect your changes.\n\nThe following section lists code samples available in other languages.\n\nStandalone code snippets\n------------------------\n\nThe lists below identify code samples available for the YouTube Data API (v3) in languages other than Java, JavaScript, PHP, and Python. As noted in the previous section, code samples for those languages are available on the [use cases and code samples](/youtube/v3/code_samples/code_snippets) page. \n\n### Apps Script\n\n| Code sample | Methods |\n|--------------------------------------------------------------------------------------------------|---------------------------------------------------------------|\n| [Add a channel subscription](/youtube/v3/code_samples/apps-script#subscribe_to_channel) | [subscriptions.insert](/youtube/v3/docs/subscriptions/insert) |\n| [Retrieve current user's uploads](/youtube/v3/code_samples/apps-script#retrieve_my_uploads) | [channels.list](/youtube/v3/docs/channels/list) |\n| [Search for videos related to a keyword](/youtube/v3/code_samples/apps-script#search_by_keyword) | [search.list](/youtube/v3/docs/search/list) |\n| [Update a video](/youtube/v3/code_samples/apps-script#update_video) | [videos.update](/youtube/v3/docs/videos/update) |\n\n### Go\n\n| Code sample | Methods |\n|-----------------------------------------------------------------------------------------|-----------------------------------------------------------|\n| [Authorize a request](/youtube/v3/code_samples/go#authorize_a_request) | Any method requiring authorization |\n| [Retrieve current user's uploads](/youtube/v3/code_samples/go#retrieve_my_uploads) | [playlistItems.list](/youtube/v3/docs/playlistItems/list) |\n| [Search for videos related to a keyword](/youtube/v3/code_samples/go#search_by_keyword) | [search.list](/youtube/v3/docs/search/list) |\n| [Upload a video](/youtube/v3/code_samples/go#upload_a_video) | [videos.insert](/youtube/v3/docs/videos/insert) |\n\n### .NET\n\n| Code sample | Methods |\n|------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|\n| [Create a playlist](/youtube/v3/code_samples/dotnet#create_a_playlist) | [playlists.insert](/youtube/v3/docs/playlists/insert) |\n| [Retrieve current user's uploaded videos](/youtube/v3/code_samples/dotnet#retrieve_my_uploads) | [channels.list](/youtube/v3/docs/channels/list) [playlistItems.list](/youtube/v3/docs/playlistItems/list) |\n| [Search for videos related to a keyword](/youtube/v3/code_samples/dotnet#search_by_keyword) | [search.list](/youtube/v3/docs/search/list) |\n| [Upload a video](/youtube/v3/code_samples/dotnet#upload_a_video) | [videos.insert](/youtube/v3/docs/videos/insert) |\n\n### Ruby\n\n| Code sample | Methods |\n|-------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|\n| [Authorize a request](/youtube/v3/code_samples/ruby#authorize_a_request) | Any method requiring authorization |\n| [Create a channel subscription](/youtube/v3/code_samples/ruby#add_a_channel_subscription) | [subscriptions.insert](/youtube/v3/docs/subscriptions/insert) |\n| [Retrieve current user's uploads](/youtube/v3/code_samples/ruby#retrieve_my_uploads) | [channels.list](/youtube/v3/docs/channels/list) [playlistItems.list](/youtube/v3/docs/playlistItems/list) |\n| [Search for videos related to a keyword](/youtube/v3/code_samples/ruby#search_by_keyword) | [search.list](/youtube/v3/docs/search/list) |\n| [Upload a video](/youtube/v3/code_samples/ruby#upload_a_video) | [videos.insert](/youtube/v3/docs/videos/insert) |\n\nYou may also be able to adapt one of the other\n[Ruby samples](https://github.com/googleapis/google-api-ruby-client/tree/main/samples)."]]