mirror of
https://github.com/KnugiHK/WhatsApp-Chat-Exporter.git
synced 2026-06-06 07:58:29 +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
|
||||||
|
|||||||
@@ -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,11 +28,23 @@
|
|||||||
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>
|
||||||
@@ -41,6 +54,7 @@
|
|||||||
{% 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">
|
||||||
|
<a class="anchor" id="{{ msg.key_id }}"></a>
|
||||||
{% if determine_day(last.last, msg.timestamp) is not none %}
|
{% if determine_day(last.last, msg.timestamp) is not none %}
|
||||||
<div class="w3-center" style="color:#70777c;padding: 10px 0 10px 0;">{{ determine_day(last.last, msg.timestamp) }}</div>
|
<div class="w3-center" style="color:#70777c;padding: 10px 0 10px 0;">{{ determine_day(last.last, msg.timestamp) }}</div>
|
||||||
{% if last.update({'last': msg.timestamp}) %}{% endif %}
|
{% if last.update({'last': msg.timestamp}) %}{% endif %}
|
||||||
@@ -53,8 +67,14 @@
|
|||||||
<div class="w3-row">
|
<div class="w3-row">
|
||||||
<div class="w3-col m10 l10">
|
<div class="w3-col m10 l10">
|
||||||
<div style="text-align: right;">
|
<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 %}
|
{% if msg.media == false %}
|
||||||
{% filter escape %}{{ msg.data or "{This message is not supported yet}" }}{% endfilter %}
|
{% filter escape %}{{ msg.data or "{This message is not supported yet}" | replace('\n', '<br>') }}{% endfilter %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if "image/" in msg.mime %}
|
{% if "image/" in msg.mime %}
|
||||||
<img src="{{ msg.data }}" />
|
<img src="{{ msg.data }}" />
|
||||||
@@ -74,7 +94,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="w3-col m2 l2" style="padding-left: 10px"><img src="{{ my_avatar }}"></div>
|
<div class="w3-col m2 l2" style="padding-left: 10px"><img src="{{ my_avatar }}" onerror="this.style.display='none'"></div>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="w3-row">
|
<div class="w3-row">
|
||||||
@@ -91,6 +111,12 @@
|
|||||||
<div class="w3-col m2 l2"><img src="{{ their_avatar }}"></div>
|
<div class="w3-col m2 l2"><img src="{{ their_avatar }}"></div>
|
||||||
<div class="w3-col m10 l10">
|
<div class="w3-col m10 l10">
|
||||||
<div style="text-align: left;">
|
<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 %}
|
{% if msg.media == false %}
|
||||||
{% filter escape %}{{ msg.data or "{This message is not supported yet}" }}{% endfilter %}
|
{% filter escape %}{{ msg.data or "{This message is not supported yet}" }}{% endfilter %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|||||||
Reference in New Issue
Block a user