Skip to main content

UNOFFICIAL API for zhihu. This package supports only Python 3.x.

A Node.js implementation is also available.

Installation

$ pip install zhihuapi

Quich Start

import zhihuapi as api

with open('cookie') as f:
    api.cookie(f.read())

data = api.user('zhihuadmin').profile()
print(data)

The result is:

{
    "url_token": "zhihuadmin",
    "avatar_url": "https://pic3.zhimg.com/34bf96bf5584ac4b5264bd7ed4fdbc5a_is.jpg",
    "avatar_url_template": "https://pic3.zhimg.com/34bf96bf5584ac4b5264bd7ed4fdbc5a_{size}.jpg",
    "type": "people",
    "name": "知乎小管家",
    "headline": "欢迎反馈问题和建议!",
    "is_org": false,
    "url": "https://www.zhihu.com/people/zhihuadmin",
    "badge": [
        {
            "type": "identity",
            "description": "知乎官方帐号"
        }
    ],
    "user_type": "people",
    "is_advertiser": false,
    "id": "3d198a56310c02c4a83efb9f4a4c027e"
}

License

MIT

Download files

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

Source Distribution

zhihuapi-0.6.0.tar.gz (10.1 kB view details)

Uploaded Source

File details

Details for the file zhihuapi-0.6.0.tar.gz.

File metadata

  • Download URL: zhihuapi-0.6.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for zhihuapi-0.6.0.tar.gz
Algorithm Hash digest
SHA256 432970d47ac75d045bda16047d170db063b89539d10fa1c60f8256ea8cb606ad
MD5 c7434025df29a81930cc1e4f3fe62429
BLAKE2b-256 444b09f9e0f4f552658d200f5be3bd81ffacd1ae87a25142a79225d92d953f56

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.6.0 This release

1 file

0.5.0

1 file

0.2.0

1 file

0.1.3

1 file

0.1.2

1 file

0.1.1

1 file

0.1.0

1 file

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