Skip to content

Commit

Permalink
Merge pull request #182 from xenova/fixes
Browse files Browse the repository at this point in the history
More fixes
  • Loading branch information
xenova committed Nov 29, 2022
2 parents cc732e3 + d840dea commit 2c92ed5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion chat_downloader/output/continuous_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ def __enter__(self):
return self

def close(self):
self.writer.close()
if self._initialised:
self.writer.close()

def __exit__(self, exc_type, exc_val, exc_tb):
self.close()
16 changes: 15 additions & 1 deletion chat_downloader/sites/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,15 @@ def __init__(self, **kwargs):
'messages_condition': lambda messages: len(messages) > 0,
}
},

{ # https://github.com/xenova/chat-downloader/issues/175#issue-1438381085
'name': 'Chat replay with a message that has no author name',
'params': {
'url': 'https://www.youtube.com/watch?v=-JU0rbfPECY',
'timeout': 5,
'start_time': '1:53:29',
'end_time': '1:53:30',
}
},



Expand Down Expand Up @@ -684,6 +692,10 @@ def _parse_item(item, info=None, offset=0):

BaseChatDownloader._move_to_dict(info, 'author')

# Sometimes YouTube channels can have no names, so, account for this
if 'author' in info and 'name' not in info['author']:
info['author']['name'] = ''

# TODO determine if youtube glitch has occurred
# round(time_in_seconds/timestamp) == 1
time_in_seconds = info.get('time_in_seconds')
Expand Down Expand Up @@ -905,6 +917,8 @@ def _parse_currency(item):
# gifts
'primaryText': r('message', _parse_text),

'bannerProperties': 'banner_properties',
'headerOverlayImage': r('header_overlay_image', _parse_thumbnails),
}

_COLOUR_KEYS = [
Expand Down

0 comments on commit 2c92ed5

Please sign in to comment.