{"id":23171714,"url":"https://github.com/smarthypercube/qzone-api","last_synced_at":"2025-08-18T07:32:13.943Z","repository":{"id":40270248,"uuid":"74014222","full_name":"SmartHypercube/Qzone-API","owner":"SmartHypercube","description":"QQ空间的Python接口","archived":false,"fork":false,"pushed_at":"2022-05-17T07:46:54.000Z","size":27,"stargazers_count":154,"open_issues_count":1,"forks_count":28,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-06T00:32:17.035Z","etag":null,"topics":["python","qzone"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SmartHypercube.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-17T10:02:13.000Z","updated_at":"2025-01-24T17:24:29.000Z","dependencies_parsed_at":"2022-08-23T16:41:02.221Z","dependency_job_id":null,"html_url":"https://github.com/SmartHypercube/Qzone-API","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SmartHypercube/Qzone-API","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartHypercube%2FQzone-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartHypercube%2FQzone-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartHypercube%2FQzone-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartHypercube%2FQzone-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SmartHypercube","download_url":"https://codeload.github.com/SmartHypercube/Qzone-API/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartHypercube%2FQzone-API/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270961686,"owners_count":24675914,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","qzone"],"created_at":"2024-12-18T04:19:19.981Z","updated_at":"2025-08-18T07:32:13.706Z","avatar_url":"https://github.com/SmartHypercube.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# QQ空间说说接口\n\n这是一个可以用来访问QQ空间说说详细信息的Python模块，能够为用户解析出有用的信息。\n\n## 用法\n\n首先要通过传入cookies创建一个`Qzone`对象，其次调用它的`emotion_list`方法，可以取得QQ号为`uin`的用户从第`pos`条起的连续`num`条说说（最新的说说为0号）。这个方法的返回值是一个`list`，其中包含若干个`Emotion`对象。\n\n`Emotion`对象表示一条说说，包含以下属性：\n\n- `tid`: 一个能唯一标识说说的字符串；\n- `author`: 作者QQ号；\n- `nickname`: 作者昵称或备注；\n- `ctime`: 说说发布时间，Unix时间戳形式；\n- `shortcon`: 说说正文的前面一部分正文；\n- `content`: 说说完整正文；\n- `pictures`: 一个`list`，其中包含若干个`Media`对象，用来表示说说中的附图和视频，后面会讲到；\n- `origin`: 一个`Emotion`对象或`None`，被转发的原说说；\n- `location`: 位置信息，是一个dict；\n- `source`: 发布说说所用的设备或途径名称；\n- `forwardn`: 被转发的次数；\n- `like`: 一个`dict`，键为点赞的人的QQ号，值为二元组`(昵称, 头像Picture对象)`。\n- `comments`: 一个`list`，其中包含若干个`Comment`对象，后面会讲到；\n- `forwards`: 一个`list`，其中包含若干个`Emotion`对象，它们都是对这条说说的转发；\n\n**注意**：Emotion中的一些属性，或一些列表的末端几项可能是`qzone.NotLoaded`，表示它们需要额外发一次请求来加载。调用`load()`方法可以把所有信息都加载出来。\n\n`Comment`对象表示一条评论，包含以下属性：\n\n- `tid`: 一个能在其所属的说说内部唯一标识评论的数字；\n- `author`: 作者QQ号；\n- `nickname`: 作者昵称或备注；\n- `ctime`: 发布时间，Unix时间戳形式；\n- `content`: 评论正文；\n- `pictures`: 一个`list`，其中包含若干个`Media`对象，后面会讲到。\n- `replys`: 一个`list`，其中包含若干个`Comment`对象，是对这条评论的评论（根据QQ空间规则，这些评论的评论的`replys`必为空列表）；\n\n`Media`对象表示一个媒体，包含以下属性或方法：\n - `url`：图片(或视频缩略图)；\n - `type`：媒体类型，为`Video`或`Image`；\n - `video_url`：视频url __（请注意视频URL随cookie失效而失效，要及时下载）__；\n - `open`：会返回一个类似于文件的对象，可以调用这个对象的`read()`方法来读出图片数据；\n - `open_video()`：第一个返回值为类似于文件的对象，可以调用这个对象的`read()`方法读出视频数据；第二个返回值为请求时返回的错误(str型)。\n\n## 特别提供的小工具\n\n`qzone.Qzone(**qzone.cookie_str_to_dict('a=1; b=2; c=3'))`可以从cookie字符串创建`Qzone`对象\n\n`qzone.Qzone(**qzone.get_cookie_from_curl(\"curl --header 'Host: qzone.qq.com' --header 'User-Agent: ...' --header 'Cookie: a=1; b=2; c=3' 'http://qzone.qq.com/' -O -J -L\"))`可以从curl命令（在装了相关插件的浏览器上会很容易取得）中提取出cookie部分，创建`Qzone`对象\n\n不妨试试`print(一个emotion)`？\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmarthypercube%2Fqzone-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmarthypercube%2Fqzone-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmarthypercube%2Fqzone-api/lists"}