Aktualizujemy interfejs Data API, aby był zgodny ze sposobem zliczania przez YouTube wyświetleń filmów Short.
Więcej informacji
Wdrożenie: czynności
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
YouTube wycofuje funkcję wiadomości na kanale. W związku z tym metoda
activities.insert
zostanie wycofana, a metoda
activities.list
przestanie zwracać informacje o informacjach o kanałach. Zmiany te zaczną obowiązywać w interfejsie API 18 maja 2020 r. lub później. Więcej informacji znajdziesz w
Centrum pomocy YouTube.
Poniższe przykłady pokazują, jak używać interfejsu YouTube Data API (w wersji 3) do wykonywania funkcji związanych z aktywnością użytkowników.
Pobieranie listy aktywności kanału
Aby pobrać listę zdarzeń związanych z określonym kanałem, wywołaj metodę activities.list
, korzystając z jednej z tych 2 metod identyfikacji kanału:
Pobieranie listy działań związanych z subskrypcją
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2024-11-23 UTC.
[null,null,["Ostatnia aktualizacja: 2024-11-23 UTC."],[[["\u003cp\u003eYouTube is removing the channel bulletin feature, which impacts how channel activity is managed.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eactivities.insert\u003c/code\u003e method will be deprecated, and \u003ccode\u003eactivities.list\u003c/code\u003e will no longer return channel bulletins after May 18, 2020.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve a list of channel activities using the \u003ccode\u003eactivities.list\u003c/code\u003e method by either setting the \u003ccode\u003emine\u003c/code\u003e parameter to \u003ccode\u003etrue\u003c/code\u003e for the authenticated user or by specifying a \u003ccode\u003echannelId\u003c/code\u003e for a particular channel.\u003c/p\u003e\n"],["\u003cp\u003eTo view subscription activities for the authenticated user, you must use the \u003ccode\u003eactivities.list\u003c/code\u003e method with the \u003ccode\u003ehome\u003c/code\u003e parameter set to \u003ccode\u003etrue\u003c/code\u003e.\u003c/p\u003e\n"]]],["YouTube is removing the channel bulletin feature. Consequently, the `activities.insert` method will be deprecated, and `activities.list` will no longer return channel bulletins, effective on or after May 18, 2020. The `activities.list` method can still be used to retrieve channel activities by setting `mine=true` for the authenticated user's activities or using the `channelId` parameter. You can also retrieve subscription activities by setting `home=true`.\n"],null,["# Implementation: Activities\n\nYouTube is deprecating the channel bulletin feature. As a result, the [activities.insert](/youtube/v3/docs/activities/insert) method will be deprecated, and the [activities.list](/youtube/v3/docs/activities/list) method will stop returning channel bulletins. These changes will be effective in the API on or after May 18, 2020. For more details, please see the [YouTube Help Center](https://support.google.com/youtube?p=channel-bulletins).\n\nThe following examples show how to use the YouTube Data API (v3) to perform functions related to user activity.\n\nRetrieve a list of channel activities\n-------------------------------------\n\nTo retrieve a list of events related to a particular channel, call the [activities.list](/youtube/v3/docs/activities/list) method using one of the following two methods to identify the channel:\n\n- Set the [mine](/youtube/v3/docs/activities/list#mine) parameter value to `true` to retrieve a list of the currently authenticated user's activities. Your request must be authorized using OAuth 2.0.\n\n ```\n https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.activities.list?\n part=snippet,contentDetails\n &mine=true\n ```\n- Set the [channelId](/youtube/v3/docs/activities/list#channelId) parameter to the YouTube channel ID that uniquely identifies the channel for which you are retrieving an activity list. This example sets the `channelId` parameter to `UCK8sQmJBp8GCxrOtXWBpyEA`, which also identifies Google's official YouTube channel.\n\n ```\n https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.activities.list?\n part=snippet,contentDetails\n &channelId=UCK8sQmJBp8GCxrOtXWBpyEA\n ```\n\nRetrieve a list of subscription activities\n------------------------------------------\n\nSubscription activities refer to events associated with channels that the authenticated user subscribes to. To retrieve a list of subscription activities for the currently authenticated user, call the [activities.list](/youtube/v3/docs/activities/list) method and set the [home](/youtube/v3/docs/activities/list#home) parameter's value to `true`. The request must be authorized using OAuth 2.0. \n\n```\nhttps://developers.google.com/apis-explorer/#p/youtube/v3/youtube.activities.list?\n part=snippet,contentDetails\n &home=true\n```"]]