diff --git a/pytchat/processors/html_archiver.py b/pytchat/processors/html_archiver.py
index e33d2fc..f969a3a 100644
--- a/pytchat/processors/html_archiver.py
+++ b/pytchat/processors/html_archiver.py
@@ -3,6 +3,7 @@ import os
import re
import time
from base64 import standard_b64encode
+from concurrent.futures import ThreadPoolExecutor
from .chat_processor import ChatProcessor
from .default.processor import DefaultProcessor
from ..exceptions import UnknownConnectionError
@@ -54,6 +55,7 @@ class HTMLArchiver(ChatProcessor):
self.header = [HEADER_HTML]
self.body = ['
\n', '\n', self._parse_table_header(fmt_headers)]
self.callback = callback
+ self.executor = ThreadPoolExecutor(max_workers=10)
def _checkpath(self, filepath):
splitter = os.path.splitext(os.path.basename(filepath))
@@ -80,7 +82,7 @@ class HTMLArchiver(ChatProcessor):
save_path : str :
Actual save path of file.
total_lines : int :
- count of total lines written to the file.
+ Count of total lines written to the file.
"""
if chat_components is None or len(chat_components) == 0:
return
@@ -132,7 +134,7 @@ class HTMLArchiver(ChatProcessor):
def _set_emoji_table(self, item: dict):
emoji_id = item['id']
if emoji_id not in self.emoji_table:
- self.emoji_table.setdefault(emoji_id, self._encode_img(item['url']))
+ self.emoji_table.setdefault(emoji_id, self.executor.submit(self._encode_img, item['url']))
return emoji_id
def _stylecode(self, name, code, width, height):
@@ -143,11 +145,12 @@ class HTMLArchiver(ChatProcessor):
def _create_styles(self):
return '\n'.join(('\n'))
def finalize(self):
+ self.executor.shutdown()
self.header.extend([self._create_styles(), '\n'])
self.body.extend(['
\n