diff --git a/platypush/plugins/youtube/__init__.py b/platypush/plugins/youtube/__init__.py index 6dcee9b9c0..6d72f200cd 100644 --- a/platypush/plugins/youtube/__init__.py +++ b/platypush/plugins/youtube/__init__.py @@ -360,6 +360,19 @@ class YoutubePlugin(Plugin): json={'playlistId': id}, ) + @action + def is_subscribed(self, channel_id: str) -> bool: + """ + Check if the user is subscribed to a channel. + + :param channel_id: YouTube channel ID. + :return: True if the user is subscribed to the channel, False otherwise. + """ + return self._request( + 'subscribed', + params={'channelId': channel_id}, + ).get('subscribed', False) + @action def subscribe(self, channel_id: str): """