diff --git a/commands.py b/commands.py index 6fc4b02..d5ded42 100644 --- a/commands.py +++ b/commands.py @@ -101,12 +101,16 @@ class Commands(object): def query_youtube(self, query): api_key = self.config['Youtube'].get('api_key') - channel_id = self.config['Youtube'].get('channel_id') + channel_ids = self.config['Youtube'].get('channel_ids').split(',') yt = Youtube(api_key) try: - results = yt.search(channel_id, query, playlists=True, limit=1) - if not results: + for channel_id in channel_ids: + results = yt.search(channel_id, query, playlists=True, limit=1) + if results: + break results = yt.search(channel_id, query, playlists=False, limit=1) + if results: + break result = results.pop(0) except (YoutubeError, IndexError): raise CommandError('couldn\'t find anything on Youtube') diff --git a/settings.cfg.example b/settings.cfg.example index cc27a6a..f0a552b 100644 --- a/settings.cfg.example +++ b/settings.cfg.example @@ -22,8 +22,8 @@ keywords = #bellameeze,bella,teeny,kitty,cat,😹,😻,🐱,🐈 [Youtube] api_key = __GOOGLE_API_KEY__ -# ladylilia -channel_id = UC5970RJMoEcRNZl0MNp8tlQ +# Lady Lilia, Lilia Live +channel_ids = UC5970RJMoEcRNZl0MNp8tlQ,UCHNjavmkFUf2n0uzWSgj16w [Quotes] api_url = https://ladylilia.com/quotes/api