diff --git a/Whatsapp_Chat_Exporter/__main__.py b/Whatsapp_Chat_Exporter/__main__.py
index 7f7b7ca..4a2600b 100644
--- a/Whatsapp_Chat_Exporter/__main__.py
+++ b/Whatsapp_Chat_Exporter/__main__.py
@@ -296,7 +296,15 @@ def main():
default=None,
type=str,
const="result",
- help="Export chats in text format similar to what WhatsApp officially provided (default if present: result/)")
+ help="Export chats in text format similar to what WhatsApp officially provided (default if present: result/)"
+ )
+ parser.add_argument(
+ "--experimental-new-theme",
+ dest="whatsapp_theme",
+ default=False,
+ action='store_true',
+ help="Use the newly designed WhatsApp-alike theme"
+ )
args = parser.parse_args()
@@ -358,6 +366,8 @@ def main():
args.filter_date = f"<= {_timestamp - APPLE_TIME}"
else:
parser.error("Unsupported date format. See https://wts.knugi.dev/docs?dest=date")
+ if args.whatsapp_theme:
+ args.template = "whatsapp_new.html"
if args.filter_chat_include is not None and args.filter_chat_exclude is not None:
parser.error("Chat inclusion and exclusion filters cannot be used together.")
if args.filter_chat_include is not None:
@@ -502,7 +512,8 @@ def main():
args.offline,
args.size,
args.no_avatar,
- args.filter_empty
+ args.filter_empty,
+ args.whatsapp_theme
)
else:
print(
@@ -539,7 +550,8 @@ def main():
args.offline,
args.size,
args.no_avatar,
- args.filter_empty
+ args.filter_empty,
+ args.whatsapp_theme
)
for file in glob.glob(r'*.*'):
shutil.copy(file, args.output)
@@ -553,7 +565,8 @@ def main():
args.offline,
args.size,
args.no_avatar,
- args.filter_empty
+ args.filter_empty,
+ args.whatsapp_theme
)
if args.text_format:
diff --git a/Whatsapp_Chat_Exporter/android_handler.py b/Whatsapp_Chat_Exporter/android_handler.py
index 30cc2d9..44a3724 100644
--- a/Whatsapp_Chat_Exporter/android_handler.py
+++ b/Whatsapp_Chat_Exporter/android_handler.py
@@ -760,9 +760,10 @@ def create_html(
offline_static=False,
maximum_size=None,
no_avatar=False,
- filter_empty=True
+ filter_empty=True,
+ experimental=False
):
- template = setup_template(template, no_avatar)
+ template = setup_template(template, no_avatar, experimental)
total_row_number = len(data)
print(f"\nGenerating chats...(0/{total_row_number})", end="\r")
diff --git a/Whatsapp_Chat_Exporter/utility.py b/Whatsapp_Chat_Exporter/utility.py
index 76816b2..46826b3 100644
--- a/Whatsapp_Chat_Exporter/utility.py
+++ b/Whatsapp_Chat_Exporter/utility.py
@@ -376,10 +376,10 @@ def get_status_location(output_folder, offline_static):
w3css = os.path.join(offline_static, "w3.css")
-def setup_template(template, no_avatar):
- if template is None:
+def setup_template(template, no_avatar, experimental=False):
+ if template is None or experimental:
template_dir = os.path.dirname(__file__)
- template_file = "whatsapp.html"
+ template_file = "whatsapp.html" if not experimental else template
else:
template_dir = os.path.dirname(template)
template_file = os.path.basename(template)
diff --git a/Whatsapp_Chat_Exporter/whatsapp_new.html b/Whatsapp_Chat_Exporter/whatsapp_new.html
new file mode 100644
index 0000000..787a81d
--- /dev/null
+++ b/Whatsapp_Chat_Exporter/whatsapp_new.html
@@ -0,0 +1,368 @@
+
+
+
+ Whatsapp - {{ name }}
+
+
+
+
+
+
+
+
+
+
+
+
+ {% if not no_avatar %}
+
+ {% if their_avatar is not none %}
+
+ {% else %}
+
+ {% endif %}
+
+ {% endif %}
+
+
Chat history with {{ name }}
+ {% if status is not none %}
{{ status }}
{% endif %}
+
+
+
+
+
+ {% if next %}
+
+
+
+ {% endif %}
+
+
+
+
+
+
+
+
+ {% set last = {'last': 946688461.001} %}
+ {% for msg in msgs -%}
+ {% if determine_day(last.last, msg.timestamp) is not none %}
+
+
+ {{ determine_day(last.last, msg.timestamp) }}
+
+
+ {% if last.update({'last': msg.timestamp}) %}{% endif %}
+ {% endif %}
+
+ {% if msg.from_me == true %}
+
+
+ {% if msg.reply is not none %}
+
+
+
Replying to
+
+ {% if msg.quoted_data is not none %}
+ "{{msg.quoted_data}}"
+ {% else %}
+ this message
+ {% endif %}
+
+
+
+ {% endif %}
+
+ {% if msg.meta == true or msg.media == false and msg.data is none %}
+
+
+ {% if msg.safe %}
+ {{ msg.data | safe or 'Not supported WhatsApp internal message' }}
+ {% else %}
+ {{ msg.data or 'Not supported WhatsApp internal message' }}
+ {% endif %}
+
+
+ {% if msg.caption is not none %}
+
{{ msg.caption | urlize(none, true, '_blank') }}
+ {% endif %}
+ {% else %}
+ {% if msg.media == false %}
+ {{ msg.data | sanitize_except() | urlize(none, true, '_blank') }}
+ {% else %}
+ {% if "image/" in msg.mime %}
+
+
+
+ {% elif "audio/" in msg.mime %}
+
+ {% elif "video/" in msg.mime %}
+
+ {% elif "/" in msg.mime %}
+ The file cannot be displayed here, however it should be located at
here
+ {% else %}
+ {% filter escape %}{{ msg.data }}{% endfilter %}
+ {% endif %}
+ {% if msg.caption is not none %}
+ {{ msg.caption | urlize(none, true, '_blank') }}
+ {% endif %}
+ {% endif %}
+ {% endif %}
+
+
{{ msg.time }}
+
+
+ {% else %}
+
+
+ {% if msg.reply is not none %}
+
+
+
Replying to
+
+ {% if msg.quoted_data is not none %}
+ {{msg.quoted_data}}
+ {% else %}
+ this message
+ {% endif %}
+
+
+
+ {% endif %}
+
+ {% if msg.meta == true or msg.media == false and msg.data is none %}
+
+
+ {% if msg.safe %}
+ {{ msg.data | safe or 'Not supported WhatsApp internal message' }}
+ {% else %}
+ {{ msg.data or 'Not supported WhatsApp internal message' }}
+ {% endif %}
+
+
+ {% if msg.caption is not none %}
+
{{ msg.caption | urlize(none, true, '_blank') }}
+ {% endif %}
+ {% else %}
+ {% if msg.media == false %}
+ {{ msg.data | sanitize_except() | urlize(none, true, '_blank') }}
+ {% else %}
+ {% if "image/" in msg.mime %}
+
+
+
+ {% elif "audio/" in msg.mime %}
+
+ {% elif "video/" in msg.mime %}
+
+ {% elif "/" in msg.mime %}
+ The file cannot be displayed here, however it should be located at
here
+ {% else %}
+ {% filter escape %}{{ msg.data }}{% endfilter %}
+ {% endif %}
+ {% if msg.caption is not none %}
+ {{ msg.caption | urlize(none, true, '_blank') }}
+ {% endif %}
+ {% endif %}
+ {% endif %}
+
+
+
+ {% if msg.sender is not none %}
+ {{ msg.sender }}
+ {% endif %}
+
+
+ {{ msg.time }}
+
+
+
+ {% endif %}
+ {% endfor %}
+
+
+
+
+
+
\ No newline at end of file