푸시 알림 구독
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
YouTube Data API (v3)는 웹에서 액세스할 수 있는 리소스를 위한 서버 간 게시/구독 프로토콜인 PubSubHubbub를 통해 푸시 알림을 지원합니다. 알림은 HTTP 웹훅을 통해 구독자에게 푸시되며, 이는 설문조사 기반 솔루션보다 훨씬 더 효율적입니다. PubSubHubbub를 사용하면 최적의 폴링 간격을 결정하거나 변경되지 않은 데이터를 반복적으로 가져오지 않고도 서버가 거의 실시간으로 이벤트를 파악할 수 있습니다.
채널이 다음 활동 중 하나를 수행하면 PubSubHubbub 콜백 서버에서 Atom 피드 알림을 수신합니다.
- 동영상을 업로드할 때
- 동영상 제목 업데이트
- 동영상 설명을 업데이트할 때
다음 단계에서는 알림을 구독하는 방법을 설명합니다.
-
수신되는 Atom 피드 알림을 처리할 수 있는 콜백 서버를 설정합니다.
-
Google 허브에서 푸시 알림을 구독하려면 다음 단계를 따르세요.
-
mode를 subscribe
로 설정합니다. (또는 모드를 unsubscribe
로 설정하여 구독을 취소합니다.)
-
콜백 URL을 1단계에서 설정한 URL로 설정합니다.
-
주제 URL을 https://www.youtube.com/feeds/videos.xml?channel_id=CHANNEL_ID
로 설정합니다. 여기서 CHANNEL_ID
는 푸시 알림을 검색하려는 YouTube 채널 ID입니다.
-
콜백 서버로 전송된 알림을 처리합니다. 알림 형식은 다음과 같습니다. <yt:videoId>
요소의 값을 사용하여 새로 추가되거나 업데이트된 동영상을 식별할 수 있습니다. <yt:channelId>
요소의 값을 사용하여 해당 동영상을 소유한 채널을 식별할 수도 있습니다.
<feed xmlns:yt="http://www.youtube.com/xml/schemas/2015"
xmlns="http://www.w3.org/2005/Atom">
<link rel="hub" href="https://pubsubhubbub.appspot.com"/>
<link rel="self" href="https://www.youtube.com/xml/feeds/videos.xml?channel_id=CHANNEL_ID"/>
<title>YouTube video feed</title>
<updated>2015-04-01T19:05:24.552394234+00:00</updated>
<entry>
<id>yt:video:VIDEO_ID</id>
<yt:videoId>VIDEO_ID</yt:videoId>
<yt:channelId>CHANNEL_ID</yt:channelId>
<title>Video title</title>
<link rel="alternate" href="http://www.youtube.com/watch?v=VIDEO_ID"/>
<author>
<name>Channel title</name>
<uri>http://www.youtube.com/channel/CHANNEL_ID</uri>
</author>
<published>2015-03-06T21:40:57+00:00</published>
<updated>2015-03-09T19:05:24.552394234+00:00</updated>
</entry>
</feed>
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2023-10-26(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"]],["최종 업데이트: 2023-10-26(UTC)"],[[["The YouTube Data API v3 uses PubSubHubbub for push notifications, enabling near real-time updates without the need for constant polling."],["Your server will receive notifications when a YouTube channel uploads a video or updates a video's title or description."],["To subscribe, set up a callback server, use the Google hub with the 'subscribe' mode, provide your callback URL, and specify the YouTube channel ID in the topic URL."],["Notifications are sent as Atom feeds, and the `\u003cyt:videoId\u003e` and `\u003cyt:channelId\u003e` elements within these feeds can be used to identify the specific video and channel."]]],["The YouTube Data API uses PubSubHubbub for push notifications, sending Atom feed updates to subscribers' HTTP webhooks when a channel uploads a video, or updates a video's title or description. To subscribe, set up a callback server, then use the Google hub with `subscribe` mode, your server's callback URL, and a YouTube channel's ID-specific topic URL. Notifications, sent as Atom feeds, include the video and channel IDs, as well as video titles and other information.\n"]]