Skip to main content

line-ext-msg

ดึงข้อความ (เวลา + คนส่ง + ข้อความ + วันที่ + สถานะ) จาก LINE Chrome Extension ผ่าน Playwright แบบเกาะ Chrome ตัวจริง บัญชีของตัวเอง อ่านอย่างเดียว

ติดตั้ง

pip install line-ext-msg

ต้องมี Google Chrome ในเครื่อง ไม่ต้องรัน playwright install เพราะโปรแกรมเกาะ Chrome ที่มีอยู่ผ่าน CDP ไม่ได้ใช้ bundled chromium

ใช้งาน CLI

line-ext-msg                       # เลือกห้องใน Terminal → พิมพ์จออย่างเดียว ไม่สร้างไฟล์
line-ext-msg --save                # + เขียน rooms.json + messages_{index}.json
line-ext-msg --unread               # แสดงเฉพาะห้องที่ไม่อ่าน
line-ext-msg --limit 10 --date 2026-09-12
line-ext-msg --date-from 2026-09-01 --date-to 2026-09-12 --keyword "ใบแจ้งหนี้"
line-ext-msg --search "ใบแจ้งหนี้"  # ค้นทุกห้อง สรุปห้องที่เจอ

ครั้งแรก: โปรแกรมเปิด Chrome โปรไฟล์แยก %LOCALAPPDATA%\line-chrome-debug ให้เอง ติดตั้ง LINE + ล็อกอินในหน้าต่างนั้น (Chrome 136+ บล็อก --remote-debugging-port บนโปรไฟล์หลักโดยตรง จึงต้องใช้โปรไฟล์แยก) เปิดหน้าต่าง debug ทิ้งไว้ระหว่างรันแต่ละครั้ง ถ้าปิดหน้าต่าง LINE จะให้ล็อกอินใหม่เพราะ token ฝั่ง extension ไม่ข้ามการรีสตาร์ทเบราว์เซอร์

หน้าตาไฟล์ JSON ที่ได้

{
  "room": { "index": 0, "id": "CXX...", "name": "ครอบครัว", "unread": 3,
            "last_preview": "กินข้าวยัง", "last_time": "8:13 AM" },
  "fetched_at": "2026-09-12T01:00:00+00:00",
  "messages": [
    { "id": "0178...", "date": "2026-09-12", "ts": "2026-09-12T08:13:00",
      "sender": "แม่", "from_me": false, "type": "text",
      "text": "กินข้าวยัง", "read_count": null }
  ]
}

ข้อจำกัดที่ควรรู้

  • รายชื่อห้องกับข้อความในห้องเป็น virtualized list โปรแกรมเลื่อนโหลดเพิ่มให้เองแบบมีเพดานเวลา (LINE_EXT_MSG_ROOMS_SCROLL_MS, LINE_EXT_MSG_MSGS_SCROLL_MS) ปิดได้ด้วย --no-scroll-msgs หรือตั้งค่าเป็น 0
  • ได้เฉพาะที่ UI แสดง ไม่มี API สถานะอ่านรายข้อความ
  • session ล็อกอินผูกกับเบราว์เซอร์ที่เปิดอยู่ ปิดหน้าต่าง debug แล้วเปิดใหม่ต้องล็อกอินใหม่ วิธีใช้คือเปิดทิ้งไว้แล้วรันซ้ำ (โปรแกรมเกาะ instance เดิมให้เอง)
  • from_me เป็น heuristic (ไม่มี username = เราส่ง) ยังไม่ยืนยันด้วย dump ที่มีข้อความของตัวเอง

dev

uv sync
uv run pytest
uv build

ถ้าอ่านห้องไม่ได้ (LINE อัปเดต UI)

line-ext-msg --dump              # DOM หน้า chats → line_dom.html
line-ext-msg --dump-room 0       # DOM ในห้อง → line_room.html
# ส่งไฟล์มาเพื่อจูน selector ใน src/line_ext_msg/settings.py

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

line_ext_msg-1.1.0.tar.gz (55.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

line_ext_msg-1.1.0-py3-none-any.whl (31.6 kB view details)

Uploaded Python 3

File details

Details for the file line_ext_msg-1.1.0.tar.gz.

File metadata

  • Download URL: line_ext_msg-1.1.0.tar.gz
  • Upload date:
  • Size: 55.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for line_ext_msg-1.1.0.tar.gz
Algorithm Hash digest
SHA256 f788b70f0e91e0cb14daefc9dd89122da97fcac17249383a80b159d5e2c6f3a8
MD5 c11e28c76eab37f1a3bd09c3c3ef0fc7
BLAKE2b-256 5e09b7d1201b77be6c01c4f141662334425a02cb82be7a659426e4ee6d3da3bb

See more details on using hashes here.

File details

Details for the file line_ext_msg-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: line_ext_msg-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 31.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for line_ext_msg-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cabad330024837e98ac0197e4a03eb87a4f4920a3c9f2ae71d71a145b9bbcb31
MD5 ae931736c49124e82dc24c2896d78b13
BLAKE2b-256 24297264c33528d4d38335383c92091452c8477a82b7d6063ed5397741cdd8ba

See more details on using hashes here.

Release history Release notifications | RSS feed

1.2.0

2 files

This release

1.1.0 This release

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page