linelog2py is a LINE Chat History parser for Python.
This is a Python library to help you import LINE chat history files for text analysis, etc. It supports the input of a text file which can be output from the LINE talk room settings screen -> Other Settings -> Export Chat History.The loaded messages are treated as a list of Message class. The language setting of LINE must be set to either English or Japanese when outputting the file.
- Python 3.7.15 or later required
You can install it via PyPI.
# PyPI
$ pip install linelog2py
Reading a file via Reader will output a list of Message.
from linelog2py import *
file = './line_history.txt'
messages = Reader.readFile(file)
for message in messages:
print(message)You can run the example program as follows:
$ python example/main.py-
time: datetimeDate and time the message was sent -
username: strUser's display name -
textlines: List[str]List of message sentences -
kind: CategoryCategory of the message (Text, Sticker, etc.)
-
def addMessage(self, text: str) -> NoneAdd line to the sentences list -
def asList(self) -> List[str]Output contents as list
NONETEXTIMAGEMOVIESTAMPFILECALLCALL_CANCELLEDCALL_MISSEDCONTACTUNSENTPOLL
def fromLabel(cls, label: str)GenerateCateoryfrom label string.
def readFile(file: str) -> List[Message]Read a file from the path and return a list ofMessage.
Copyright (c) 2022 Yuji Sasaki. All rights reserved.
This software is released under the MIT License, see LICENSE.