Skip to content

The api is sending old videos #54

Description

@AndresDelgado97
class notify(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.channels = {
            "Airi Viridis Ch. 【V-Dere】": f"@AiriViridis"
        }
        self.videos = {}

    @commands.Cog.listener()
    async def on_ready(self):
        self.check.start()

    @tasks.loop(seconds=60)
    async def check(self):
        discord_channel = self.bot.get_channel(838365746069372982)

        for channel_name in self.channels:
            videos = scrapetube.get_channel(channel_url=self.channels[channel_name], limit=1,content_type="streams")
            video_ids = [video["videoId"] for video in videos]
            print(video_ids)

            if self.check.current_loop == 0:
                self.videos[channel_name] = video_ids
                continue

            for video_id in video_ids:
                if video_id not in self.videos[channel_name]:
                    url = f"https://youtu.be/{video_id}"
                    await discord_channel.send(f"@everyone\n{url}")

            self.videos[channel_name] = video_ids

def setup(bot):
    bot.add_cog(notify(bot))

I dont know if i'm doing something wrong, but when the bot is running, it sends old videos, like 1 month o more

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions