From 0d80c249f37fcece1afb36fb93cae62cdd0a1170 Mon Sep 17 00:00:00 2001 From: "55448286+taizan-hokuto@users.noreply.github.com" Date: Sun, 3 Nov 2019 12:58:35 +0900 Subject: [PATCH 1/3] Modify setup.py packages param --- pytchat/paramgen/liveparam.py | 2 +- pytchat/processors/default/processor.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pytchat/paramgen/liveparam.py b/pytchat/paramgen/liveparam.py index cf0e5b6..36eac85 100644 --- a/pytchat/paramgen/liveparam.py +++ b/pytchat/paramgen/liveparam.py @@ -132,7 +132,7 @@ def _times(): _ts1= n - random.uniform(0,1*3) _ts2= n - random.uniform(0.01,0.99) - _ts3= n - 60*60 + random.uniform(0,1) + _ts3= n - 60+random.uniform(0,1) _ts4= n - random.uniform(10*60,60*60) _ts5= n - random.uniform(0.01,0.99) return list(map(lambda x:int(x*1000000),[_ts1,_ts2,_ts3,_ts4,_ts5])) diff --git a/pytchat/processors/default/processor.py b/pytchat/processors/default/processor.py index 0b063fa..2c1834c 100644 --- a/pytchat/processors/default/processor.py +++ b/pytchat/processors/default/processor.py @@ -16,7 +16,7 @@ class Chatdata: async def tick_async(self): if self.interval == 0: - await asyncio.sleep(3) + await asyncio.sleep(0.5) return await asyncio.sleep(self.interval/len(self.items)) diff --git a/setup.py b/setup.py index 70d53a0..295d63a 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ with open('README.md', encoding='utf-8') as f: setup( name=package_name, - packages=[package_name], + packages=find_packages(), version=version, From 1625bf51e92dfcc4ff5ff508f456d65cf38d2af1 Mon Sep 17 00:00:00 2001 From: "55448286+taizan-hokuto@users.noreply.github.com" Date: Sun, 3 Nov 2019 13:12:24 +0900 Subject: [PATCH 2/3] Make it possible to set the period for reading past chat data --- pytchat/paramgen/liveparam.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pytchat/paramgen/liveparam.py b/pytchat/paramgen/liveparam.py index 36eac85..b289f2c 100644 --- a/pytchat/paramgen/liveparam.py +++ b/pytchat/paramgen/liveparam.py @@ -122,7 +122,7 @@ def _build(video_id, _ts1, _ts2, _ts3, _ts4, _ts5, topchatonly = False): ) -def _times(): +def _times(past_sec): def unixts_now(): now = datetime.datetime.now(pytz.utc) @@ -132,12 +132,18 @@ def _times(): _ts1= n - random.uniform(0,1*3) _ts2= n - random.uniform(0.01,0.99) - _ts3= n - 60+random.uniform(0,1) + _ts3= n - past_sec + random.uniform(0,1) _ts4= n - random.uniform(10*60,60*60) _ts5= n - random.uniform(0.01,0.99) return list(map(lambda x:int(x*1000000),[_ts1,_ts2,_ts3,_ts4,_ts5])) -def getparam(video_id): - return _build(video_id,*_times()) +def getparam(video_id,past_sec = 60): + ''' + Parameter + --------- + past_sec : int + seconds to load past chat data + ''' + return _build(video_id,*_times(past_sec)) From c0a790a7c49d25c1eb175a4ae6304b8589f19299 Mon Sep 17 00:00:00 2001 From: "55448286+taizan-hokuto@users.noreply.github.com" Date: Sun, 3 Nov 2019 13:14:38 +0900 Subject: [PATCH 3/3] Increment version --- pytchat/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytchat/__init__.py b/pytchat/__init__.py index 7f26001..75531ce 100644 --- a/pytchat/__init__.py +++ b/pytchat/__init__.py @@ -2,7 +2,7 @@ pytchat is a python library for fetching youtube live chat. """ __copyright__ = 'Copyright (C) 2019 taizan-hokuto' -__version__ = '0.0.1.6' +__version__ = '0.0.1.7' __license__ = 'MIT' __author__ = 'taizan-hokuto' __author_email__ = '55448286+taizan-hokuto@users.noreply.github.com'