mirror of
https://github.com/KnugiHK/WhatsApp-Chat-Exporter.git
synced 2026-04-28 00:34:54 +00:00
Support reply in android
This commit is contained in:
11
extract.py
11
extract.py
@@ -45,7 +45,7 @@ total_row_number = c.fetchone()[0]
|
|||||||
print(f"Gathering messages...(0/{total_row_number})", end="\r")
|
print(f"Gathering messages...(0/{total_row_number})", end="\r")
|
||||||
|
|
||||||
phone_number_re = re.compile(r"[0-9]+@s.whatsapp.net")
|
phone_number_re = re.compile(r"[0-9]+@s.whatsapp.net")
|
||||||
c.execute("""SELECT key_remote_jid, _id, key_from_me, timestamp, data, status, edit_version, thumb_image, remote_resource, media_wa_type, latitude, longitude FROM messages; """)
|
c.execute("""SELECT messages.key_remote_jid, messages._id, messages.key_from_me, messages.timestamp, messages.data, messages.status, messages.edit_version, messages.thumb_image, messages.remote_resource, messages.media_wa_type, messages.latitude, messages.longitude, messages_quotes.key_id as quoted, messages.key_id, messages_quotes.data FROM messages LEFT JOIN messages_quotes ON messages.quoted_row_id = messages_quotes._id; """)
|
||||||
i = 0
|
i = 0
|
||||||
content = c.fetchone()
|
content = c.fetchone()
|
||||||
while content is not None:
|
while content is not None:
|
||||||
@@ -55,7 +55,8 @@ while content is not None:
|
|||||||
"from_me": bool(content[2]),
|
"from_me": bool(content[2]),
|
||||||
"timestamp": content[3]/1000,
|
"timestamp": content[3]/1000,
|
||||||
"time": datetime.fromtimestamp(content[3]/1000).strftime("%H:%M"),
|
"time": datetime.fromtimestamp(content[3]/1000).strftime("%H:%M"),
|
||||||
"media": False
|
"media": False,
|
||||||
|
"key_id": content[13]
|
||||||
}
|
}
|
||||||
if "-" in content[0] and content[2] == 0:
|
if "-" in content[0] and content[2] == 0:
|
||||||
if content[8] in data:
|
if content[8] in data:
|
||||||
@@ -66,6 +67,12 @@ while content is not None:
|
|||||||
else:
|
else:
|
||||||
data[content[0]]["messages"][content[1]]["sender"] = None
|
data[content[0]]["messages"][content[1]]["sender"] = None
|
||||||
|
|
||||||
|
if content[12] is not None:
|
||||||
|
data[content[0]]["messages"][content[1]]["reply"] = content[12]
|
||||||
|
data[content[0]]["messages"][content[1]]["quoted_data"] = content[14]
|
||||||
|
else:
|
||||||
|
data[content[0]]["messages"][content[1]]["reply"] = None
|
||||||
|
|
||||||
if content[5] == 6:
|
if content[5] == 6:
|
||||||
if "-" in content[0]:
|
if "-" in content[0]:
|
||||||
# Is Group
|
# Is Group
|
||||||
|
|||||||
182
whatsapp.html
182
whatsapp.html
@@ -8,6 +8,7 @@
|
|||||||
html {
|
html {
|
||||||
font-family: 'Noto Sans HK', sans-serif;
|
font-family: 'Noto Sans HK', sans-serif;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
scroll-behavior: smooth;
|
||||||
}
|
}
|
||||||
header {
|
header {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@@ -27,96 +28,121 @@
|
|||||||
width:500px;
|
width:500px;
|
||||||
margin:100px auto;
|
margin:100px auto;
|
||||||
z-index:10;
|
z-index:10;
|
||||||
|
font-size: 15px;
|
||||||
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
img, video {
|
img, video {
|
||||||
max-width:100%;
|
max-width:100%;
|
||||||
width: 70%;
|
width: 70%;
|
||||||
}
|
}
|
||||||
|
a.anchor {
|
||||||
|
display: block;
|
||||||
|
position: relative;
|
||||||
|
top: -100px;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
div.reply{
|
||||||
|
font-size: 13px;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header class="w3-center w3-top">Chat history with {{ name }}</header>
|
<header class="w3-center w3-top">Chat history with {{ name }}</header>
|
||||||
<article class="w3-container">
|
<article class="w3-container">
|
||||||
<div class="table" style="width:100%">
|
<div class="table" style="width:100%">
|
||||||
{% set last = {'last': 946688461.001} %}
|
{% set last = {'last': 946688461.001} %}
|
||||||
{% for msg in msgs -%}
|
{% for msg in msgs -%}
|
||||||
<div class="w3-row" style="padding-bottom: 10px">
|
<div class="w3-row" style="padding-bottom: 10px">
|
||||||
{% if determine_day(last.last, msg.timestamp) is not none %}
|
<a class="anchor" id="{{ msg.key_id }}"></a>
|
||||||
<div class="w3-center" style="color:#70777c;padding: 10px 0 10px 0;">{{ determine_day(last.last, msg.timestamp) }}</div>
|
{% if determine_day(last.last, msg.timestamp) is not none %}
|
||||||
{% if last.update({'last': msg.timestamp}) %}{% endif %}
|
<div class="w3-center" style="color:#70777c;padding: 10px 0 10px 0;">{{ determine_day(last.last, msg.timestamp) }}</div>
|
||||||
{% endif %}
|
{% if last.update({'last': msg.timestamp}) %}{% endif %}
|
||||||
{% if msg.from_me == true %}
|
{% endif %}
|
||||||
<div class="w3-row">
|
{% if msg.from_me == true %}
|
||||||
<div style="float: left; color:#70777c;">{{ msg.time }}</div>
|
<div class="w3-row">
|
||||||
<div style="padding-left: 10px; text-align: right; color: #3892da;">You</div>
|
<div style="float: left; color:#70777c;">{{ msg.time }}</div>
|
||||||
</div>
|
<div style="padding-left: 10px; text-align: right; color: #3892da;">You</div>
|
||||||
<div class="w3-row">
|
|
||||||
<div class="w3-col m10 l10">
|
|
||||||
<div style="text-align: right;">
|
|
||||||
{% if msg.media == false %}
|
|
||||||
{% filter escape %}{{ msg.data or "{This message is not supported yet}" }}{% endfilter %}
|
|
||||||
{% else %}
|
|
||||||
{% if "image/" in msg.mime %}
|
|
||||||
<img src="{{ msg.data }}" />
|
|
||||||
{% elif "audio/" in msg.mime %}
|
|
||||||
<audio controls="controls" autobuffer="autobuffer">
|
|
||||||
<source src="{% filter escape %}{{ msg.data }}{% endfilter %}" />
|
|
||||||
</audio>
|
|
||||||
{% elif "video/" in msg.mime %}
|
|
||||||
<video controls="controls" autobuffer="autobuffer">
|
|
||||||
<source src="{% filter escape %}{{ msg.data }}{% endfilter %}" />
|
|
||||||
</video>
|
|
||||||
{% elif "/" in msg.mime %}
|
|
||||||
{The file cannot be displayed here, however it should be located at {% filter escape %}{{ msg.data }}{% endfilter %}}
|
|
||||||
{% else %}
|
|
||||||
{% filter escape %}{{ msg.data }}{% endfilter %}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="w3-col m2 l2" style="padding-left: 10px"><img src="{{ my_avatar }}"></div>
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
<div class="w3-row">
|
|
||||||
<div style="padding-right: 10px; float: left; color: #3892da;">
|
|
||||||
{% if msg.sender is not none %}
|
|
||||||
{{ msg.sender }}
|
|
||||||
{% else %}
|
|
||||||
{{ name }}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
<div style="text-align: right; color:#70777c;">{{ msg.time }}</div>
|
|
||||||
</div>
|
|
||||||
<div class="w3-row">
|
|
||||||
<div class="w3-col m2 l2"><img src="{{ their_avatar }}"></div>
|
|
||||||
<div class="w3-col m10 l10">
|
|
||||||
<div style="text-align: left;">
|
|
||||||
{% if msg.media == false %}
|
|
||||||
{% filter escape %}{{ msg.data or "{This message is not supported yet}" }}{% endfilter %}
|
|
||||||
{% else %}
|
|
||||||
{% if "image/" in msg.mime %}
|
|
||||||
<img src="{% filter escape %}{{ msg.data }}{% endfilter %}" />
|
|
||||||
{% elif "audio/" in msg.mime %}
|
|
||||||
<audio controls="controls" autobuffer="autobuffer">
|
|
||||||
<source src="{% filter escape %}{{ msg.data }}{% endfilter %}" />
|
|
||||||
</audio>
|
|
||||||
{% elif "video/" in msg.mime %}
|
|
||||||
<video controls="controls" autobuffer="autobuffer">
|
|
||||||
<source src="{% filter escape %}{{ msg.data }}{% endfilter %}" />
|
|
||||||
</video>
|
|
||||||
{% elif "/" in msg.mime %}
|
|
||||||
{The file cannot be displayed here, however it should be located at {% filter escape %}{{ msg.data }}{% endfilter %}}
|
|
||||||
{% else %}
|
|
||||||
{% filter escape %}{{ msg.data }}{% endfilter %}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
<div class="w3-row">
|
||||||
|
<div class="w3-col m10 l10">
|
||||||
|
<div style="text-align: right;">
|
||||||
|
{% if msg.reply is not none %}
|
||||||
|
<div class="reply">
|
||||||
|
<span style="color: #70777a;">Replying to </span>
|
||||||
|
<a href="#{{msg.reply}}" style="color: #168acc;">"{{ msg.quoted_data or 'media' }}"</a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if msg.media == false %}
|
||||||
|
{% filter escape %}{{ msg.data or "{This message is not supported yet}" | replace('\n', '<br>') }}{% endfilter %}
|
||||||
|
{% else %}
|
||||||
|
{% if "image/" in msg.mime %}
|
||||||
|
<img src="{{ msg.data }}" />
|
||||||
|
{% elif "audio/" in msg.mime %}
|
||||||
|
<audio controls="controls" autobuffer="autobuffer">
|
||||||
|
<source src="{% filter escape %}{{ msg.data }}{% endfilter %}" />
|
||||||
|
</audio>
|
||||||
|
{% elif "video/" in msg.mime %}
|
||||||
|
<video controls="controls" autobuffer="autobuffer">
|
||||||
|
<source src="{% filter escape %}{{ msg.data }}{% endfilter %}" />
|
||||||
|
</video>
|
||||||
|
{% elif "/" in msg.mime %}
|
||||||
|
{The file cannot be displayed here, however it should be located at {% filter escape %}{{ msg.data }}{% endfilter %}}
|
||||||
|
{% else %}
|
||||||
|
{% filter escape %}{{ msg.data }}{% endfilter %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="w3-col m2 l2" style="padding-left: 10px"><img src="{{ my_avatar }}" onerror="this.style.display='none'"></div>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="w3-row">
|
||||||
|
<div style="padding-right: 10px; float: left; color: #3892da;">
|
||||||
|
{% if msg.sender is not none %}
|
||||||
|
{{ msg.sender }}
|
||||||
|
{% else %}
|
||||||
|
{{ name }}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div style="text-align: right; color:#70777c;">{{ msg.time }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="w3-row">
|
||||||
|
<div class="w3-col m2 l2"><img src="{{ their_avatar }}"></div>
|
||||||
|
<div class="w3-col m10 l10">
|
||||||
|
<div style="text-align: left;">
|
||||||
|
{% if msg.reply is not none %}
|
||||||
|
<div class="reply">
|
||||||
|
<span style="color: #70777a;">Replying to </span>
|
||||||
|
<a href="#{{msg.reply}}" style="color: #168acc;">"{{ msg.quoted_data or 'media' }}"</a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if msg.media == false %}
|
||||||
|
{% filter escape %}{{ msg.data or "{This message is not supported yet}" }}{% endfilter %}
|
||||||
|
{% else %}
|
||||||
|
{% if "image/" in msg.mime %}
|
||||||
|
<img src="{% filter escape %}{{ msg.data }}{% endfilter %}" />
|
||||||
|
{% elif "audio/" in msg.mime %}
|
||||||
|
<audio controls="controls" autobuffer="autobuffer">
|
||||||
|
<source src="{% filter escape %}{{ msg.data }}{% endfilter %}" />
|
||||||
|
</audio>
|
||||||
|
{% elif "video/" in msg.mime %}
|
||||||
|
<video controls="controls" autobuffer="autobuffer">
|
||||||
|
<source src="{% filter escape %}{{ msg.data }}{% endfilter %}" />
|
||||||
|
</video>
|
||||||
|
{% elif "/" in msg.mime %}
|
||||||
|
{The file cannot be displayed here, however it should be located at {% filter escape %}{{ msg.data }}{% endfilter %}}
|
||||||
|
{% else %}
|
||||||
|
{% filter escape %}{{ msg.data }}{% endfilter %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
</article>
|
</article>
|
||||||
<footer class="w3-center">
|
<footer class="w3-center">
|
||||||
End of history
|
End of history
|
||||||
|
|||||||
Reference in New Issue
Block a user