Skip to main content

qlurk-python

Plurk API 的現代化 Python SDK。

  • Python 3.11+
  • OAuth 1.0a 認證
  • 乾淨的 namespace 介面(client.timeline、client.users、…)
  • 單一執行期相依套件:httpx

安裝

pip install qlurk

事前準備

你需要自己註冊一個 Plurk OAuth 應用程式。到 https://www.plurk.com/PlurkApp/ 註冊後可取得 consumer_key 與 consumer_secret,每次建立 PlurkClient 時都必須傳入 —— qlurk 本身不提供任何預設憑證。

快速開始

已有 access token 的情況

from qlurk import PlurkClient

with PlurkClient(
    consumer_key="YOUR_CONSUMER_KEY",
    consumer_secret="YOUR_CONSUMER_SECRET",
    token="USER_ACCESS_TOKEN",
    token_secret="USER_TOKEN_SECRET",
) as client:
    me = client.users.me()
    plurks = client.timeline.get_plurks()
    for p in plurks:
        print(p.url, p.content_raw)

使用帳密登入

from qlurk import PlurkClient

client = PlurkClient(
    consumer_key="YOUR_CONSUMER_KEY",
    consumer_secret="YOUR_CONSUMER_SECRET",
)
user = client.login("nickname", "password", totp_code=123456)
# token 會自動存在 client 內部,後續呼叫皆為已認證狀態。

自訂 header

所有非必要 header(例如 User-Agent)都透過單一的 headers 參數傳入,每一個 請求都會帶上。qlurk 本身除了 OAuth 的 Authorization 之外不會送出任何預設 header。若 key 衝突,OAuth header 會蓋過使用者傳入的值。

client = PlurkClient(
    consumer_key="...",
    consumer_secret="...",
    headers={
        "User-Agent": "MyBot/1.0",
        "Plurk-App-Version": "my-client/1.0",
    },
)

API namespace

PlurkClient 以 lazy 方式暴露下列 namespace:

Namespace 用途
timeline 貼文、轉噗、收藏、已讀狀態
users 使用者資料、karma、頭像上傳
responses 回應噗文
profile 公開個人資料
friends 朋友、粉絲、追蹤
alerts 通知、好友邀請
blocks 封鎖的使用者
cliques 朋友分組
bookmarks 已收藏的噗與標籤
search 噗與使用者搜尋
emoticons 自訂表情符號
polls 噗內投票
reactions Emoji 反應
video 影片上傳與預覽
premium 噗幣、禮物、廣告
forum 論壇管理

錯誤處理

from qlurk import PlurkError, AuthError, NotFoundError, RateLimitError

try:
    client.users.me()
except AuthError:
    ...
except RateLimitError:
    ...
except NotFoundError:
    ...
except PlurkError as e:
    print(e.raw)  # 原始 API 回傳的 dict

非噗浪官方

本專案與噗浪公司無任何關係,僅為民間愛好者作品。製作過程大量使用 claude code。

其中使用到噗浪官方 API 文件中未記載的 API Endpoint(如 Forum、Reaction、Video...等)。 這部分的功能噗浪未承諾其長期相容性。

授權條款

本專案以 Apache License 2.0 授權。詳見 LICENSE。

Metadata

Release files for qlurk 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qlurk 0.1.0
File Size Uploaded Provenance Actions
qlurk-0.1.0.tar.gz 21.9 kB With provenance Details for qlurk-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qlurk 0.1.0
File Interpreter ABI Platform Actions
qlurk-0.1.0-py3-none-any.whl Python 3 none any Details for qlurk-0.1.0-py3-none-any.whl

Total release size: 55.1 kB

Release files / qlurk-0.1.0.tar.gz

Download URL qlurk-0.1.0.tar.gz
Size 21.9 kB
Tags Source
SHA-256 checksum
How to use checksums
17d5c737f3bb110ae735f2a40bddd653a47aa736668acf447976e9fe10ef4cb4
BLAKE2b-256 checksum
How to use checksums
04c119a6db9c710dd9ea20d803862d0b137d9d2ff44910627af25210d6763030
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 10, 2026.

Transparency log

Release files / qlurk-0.1.0-py3-none-any.whl

Download URL qlurk-0.1.0-py3-none-any.whl
Size 33.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
96eb4979d0a8045383f191ecaff532ea89912bcdabac672697928c000b632183
BLAKE2b-256 checksum
How to use checksums
decc0e30ffa3d7377fca8dcacef025b38e8cd6a7609bd8f989216838602813e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 10, 2026.

Transparency log

Security for qlurk 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for qlurk-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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