Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The api is sending old videos #54

Open
AndresDelgado97 opened this issue Mar 8, 2024 · 0 comments
Open

The api is sending old videos #54

AndresDelgado97 opened this issue Mar 8, 2024 · 0 comments

Comments

@AndresDelgado97
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant