Compare commits

...

7 Commits

Author SHA1 Message Date
55448286+taizan-hokuto@users.noreply.github.com
30429b05a5 Merge branch 'develop' 2019-11-03 14:12:44 +09:00
55448286+taizan-hokuto@users.noreply.github.com
ca266ef04b Increment version 2019-11-03 14:12:24 +09:00
55448286+taizan-hokuto@users.noreply.github.com
8891b35dc7 Devide requirements_test.txt
/ Eliminate version from requirements.txt
2019-11-03 13:59:15 +09:00
55448286+taizan-hokuto@users.noreply.github.com
0f63e172dc Merge branch 'develop' 2019-11-03 13:14:58 +09:00
55448286+taizan-hokuto@users.noreply.github.com
c0a790a7c4 Increment version 2019-11-03 13:14:38 +09:00
55448286+taizan-hokuto@users.noreply.github.com
1625bf51e9 Make it possible to set the period for reading past chat data 2019-11-03 13:12:24 +09:00
55448286+taizan-hokuto@users.noreply.github.com
0d80c249f3 Modify setup.py packages param 2019-11-03 12:58:35 +09:00
6 changed files with 33 additions and 22 deletions

View File

@@ -2,11 +2,11 @@
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.8'
__license__ = 'MIT'
__author__ = 'taizan-hokuto'
__author_email__ = '55448286+taizan-hokuto@users.noreply.github.com'
__url__ = 'https://github.com/taizan-hokuto'
__url__ = 'https://github.com/taizan-hokuto/pytchat'
__all__ = ["core_async","core_multithread","processors"]

View File

@@ -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*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))

View File

@@ -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))

View File

@@ -1,9 +1,4 @@
aiohttp==3.6.0
aioresponses==0.6.0
mock==3.0.5
mocker==1.1.1
pytest==5.1.2
pytest-mock==1.10.4
pytz==2019.2
requests==2.22.0
urllib3==1.25.3
aiohttp
pytz
requests
urllib3

5
requirements_test.txt Normal file
View File

@@ -0,0 +1,5 @@
aioresponses
mock
mocker
pytest
pytest-mock

View File

@@ -7,8 +7,13 @@ package_name = "pytchat"
root_dir = path.abspath(path.dirname(__file__))
def _requires_from_file(filename):
return open(filename).read().splitlines()
def _requirements():
return [name.rstrip() for name in open(path.join(root_dir, 'requirements.txt')).readlines()]
def _test_requirements():
return [name.rstrip() for name in open(path.join(root_dir, 'requirements_test.txt')).readlines()]
with open(path.join(root_dir, package_name, '__init__.py')) as f:
init_text = f.read()
@@ -29,16 +34,16 @@ with open('README.md', encoding='utf-8') as f:
setup(
name=package_name,
packages=[package_name],
packages=find_packages(),
version=version,
url=url,
author=author,
author_email=author_email,
long_description=long_description,
long_description_content_type='text/markdown',
license=license,
install_requires=_requirements(),
tests_require=_test_requirements(),
description="a python library for fetching youtube live chat.",
classifiers=[
'Natural Language :: Japanese',
@@ -52,5 +57,5 @@ setup(
'License :: OSI Approved :: MIT License',
],
keywords='youtube livechat asyncio',
install_requires=_requires_from_file('requirements.txt')
)