diff --git a/pytchat/__init__.py b/pytchat/__init__.py index 2b8334b..267413d 100644 --- a/pytchat/__init__.py +++ b/pytchat/__init__.py @@ -2,7 +2,7 @@ pytchat is a python library for fetching youtube live chat without using yt api, Selenium, or BeautifulSoup. """ __copyright__ = 'Copyright (C) 2019 taizan-hokuto' -__version__ = '0.0.6.1' +__version__ = '0.0.6.2' __license__ = 'MIT' __author__ = 'taizan-hokuto' __author_email__ = '55448286+taizan-hokuto@users.noreply.github.com' diff --git a/pytchat/core_async/buffer.py b/pytchat/core_async/buffer.py index 5abdc7a..e93357e 100644 --- a/pytchat/core_async/buffer.py +++ b/pytchat/core_async/buffer.py @@ -20,6 +20,13 @@ class Buffer(asyncio.Queue): super().get_nowait() await super().put(item) + def put_nowait(self,item): + if item is None: + return + if super().full(): + super().get_nowait() + super().put_nowait(item) + async def get(self): ret = [] ret.append(await super().get()) diff --git a/pytchat/core_multithread/buffer.py b/pytchat/core_multithread/buffer.py index c1ef2fe..3898572 100644 --- a/pytchat/core_multithread/buffer.py +++ b/pytchat/core_multithread/buffer.py @@ -22,7 +22,14 @@ class Buffer(queue.Queue): else: super().put(item) - + def put_nowait(self,item): + if item is None: + return + if super().full(): + super().get_nowait() + else: + super().put_nowait(item) + def get(self): ret = [] ret.append(super().get())