diff --git a/pytchat/cli/__init__.py b/pytchat/cli/__init__.py index 6c95e19..c3c16ac 100644 --- a/pytchat/cli/__init__.py +++ b/pytchat/cli/__init__.py @@ -44,11 +44,17 @@ def main(): f" video_id: {video_id}\n" f" channel: {info.get_channel_name()}\n" f" title: {info.get_title()}") + path = Path(Arguments().output+video_id+'.html') + print(f"output path: {path.resolve()}") Extractor(video_id, - processor = HTMLArchiver(Arguments().output+video_id+'.html') + processor = HTMLArchiver(Arguments().output+video_id+'.html'), + callback = _disp_progress ).extract() - print("Extraction end.\n") + print("\nExtraction end.\n") except (InvalidVideoIdException, NoContentsException) as e: print(e) return parser.print_help() + +def _disp_progress(a,b): + print('.',end="",flush=True) diff --git a/pytchat/processors/html_archiver.py b/pytchat/processors/html_archiver.py index 45626ab..9249cf4 100644 --- a/pytchat/processors/html_archiver.py +++ b/pytchat/processors/html_archiver.py @@ -8,6 +8,11 @@ PATTERN = re.compile(r"(.*)\(([0-9]+)\)$") fmt_headers = ['datetime','elapsed','authorName','message','superchat' ,'type','authorChannel'] +HEADER_HTML = ''' + + +''' + class HTMLArchiver(ChatProcessor): ''' HtmlArchiver saves chat data as HTML table format. @@ -17,6 +22,7 @@ class HTMLArchiver(ChatProcessor): super().__init__() self.save_path = self._checkpath(save_path) with open(self.save_path, mode='a', encoding = 'utf-8') as f: + f.write(HEADER_HTML) f.write('