diff --git a/.github/workflows/run_test.yml b/.github/workflows/run_test.yml new file mode 100644 index 0000000..eb8cf62 --- /dev/null +++ b/.github/workflows/run_test.yml @@ -0,0 +1,27 @@ +name: Run All UnitTest + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + max-parallel: 4 + matrix: + python-version: [3.7, 3.8] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt -r requirements_test.txt + - name: Test with pytest + run: | + export PYTHONPATH=./ + pytest --verbose --color=yes \ No newline at end of file diff --git a/pytchat/processors/default/renderer/base.py b/pytchat/processors/default/renderer/base.py index d6826c9..3c99951 100644 --- a/pytchat/processors/default/renderer/base.py +++ b/pytchat/processors/default/renderer/base.py @@ -1,4 +1,4 @@ -from datetime import datetime +from datetime import datetime, timedelta, timezone class Author: @@ -90,7 +90,8 @@ class BaseRenderer: self.chat.author.badgeUrl = badge["liveChatAuthorBadgeRenderer"]["customThumbnail"]["thumbnails"][0]["url"] def get_datetime(self, timestamp): - dt = datetime.fromtimestamp(timestamp / 1000000) + jst = timezone(timedelta(hours=9)) + dt = datetime.fromtimestamp(timestamp / 1000000, jst) return dt.strftime('%Y-%m-%d %H:%M:%S') def get_chatobj(self):