{"id":14978777,"url":"https://github.com/algebra-fun/wereadscan","last_synced_at":"2025-05-15T20:01:00.314Z","repository":{"id":39405315,"uuid":"275305472","full_name":"Algebra-FUN/WeReadScan","owner":"Algebra-FUN","description":"扫描“微信读书”已购图书并下载本地PDF的爬虫","archived":false,"fork":false,"pushed_at":"2023-09-19T08:18:38.000Z","size":532,"stargazers_count":945,"open_issues_count":11,"forks_count":167,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-05-08T06:05:16.932Z","etag":null,"topics":["book-downloader","selenium","web-crawler","weread"],"latest_commit_sha":null,"homepage":"https://algebra-fun.github.io/WeReadScan/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Algebra-FUN.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-27T05:21:55.000Z","updated_at":"2025-05-07T10:05:27.000Z","dependencies_parsed_at":"2024-09-28T02:01:05.979Z","dependency_job_id":null,"html_url":"https://github.com/Algebra-FUN/WeReadScan","commit_stats":{"total_commits":42,"total_committers":5,"mean_commits":8.4,"dds":"0.38095238095238093","last_synced_commit":"b3714d390a0355f9b1b7f7ed538a3bdfe52df194"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Algebra-FUN%2FWeReadScan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Algebra-FUN%2FWeReadScan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Algebra-FUN%2FWeReadScan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Algebra-FUN%2FWeReadScan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Algebra-FUN","download_url":"https://codeload.github.com/Algebra-FUN/WeReadScan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254414457,"owners_count":22067263,"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","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":["book-downloader","selenium","web-crawler","weread"],"created_at":"2024-09-24T13:58:22.531Z","updated_at":"2025-05-15T20:00:59.605Z","avatar_url":"https://github.com/Algebra-FUN.png","language":"Python","readme":"# WeReadScan\n\n![GitHub last commit](https://img.shields.io/github/last-commit/Algebra-FUN/WeReadScan) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/Algebra-FUN/WeReadScan) ![GitHub top language](https://img.shields.io/github/languages/top/Algebra-FUN/WeReadScan) [![pip](https://img.shields.io/badge/pip-0.8.7-orange)](https://pypi.org/project/WeReadScan/)\n\n## About\n\n一个用于的将`微信读书`上的图书扫描转换本地PDF/HTML的爬虫库.\n\n### 谈谈为何而开发\n\n不得不说，“微信读书”是一个很好的平台。但是美中不足很明显，用户购买了图书资源，但是只能在“微信读书”的Application中阅读或者做一些文字批注╮(╯▽╰)╭，这些功能相较于购买的纸质书籍显然是不足的。比如，作者就习惯于用iPad的相关notebook类app做笔记，而“微信读书”并没有适配pencil做handwriting笔记的功能。\n\n因此，既然“微信读书”没有提供，那只好自己解决了。于是，经过2天的开发，终于有了这个爬虫脚本，也可以开心地做手写笔记了o(_￣▽￣_)ブ\n\n### 相关版本\n\n在[Sec-ant](https://github.com/Sec-ant)的建议下，参考了他的解决方案[weread-scraper](https://github.com/Sec-ant/weread-scraper)，将其中最重要的获取#preRenderContent的部分脚本进行整合，得到了[WeReadScan-HTML](https://github.com/Algebra-FUN/WeReadScan/tree/html-variant)版本，可以直接自动化获得多本图书的HTML，更加高效。\n\n## Get started\n\n```shell\npip install WeReadScan-HTML\n```\n\n\u003e 本项目需要使用selenium，需要对selenium具备基础的了解\n\n### Demo\n\n话不多说，直接上代码\n\n```python\nfrom selenium.webdriver import Edge\nfrom selenium.webdriver.chrome.service import Service\nfrom selenium.webdriver.edge.options import Options\n\nfrom WeReadScan import WeRead\n\noptions = Options()\noptions.add_argument(\"--disable-blink-features=AutomationControlled\")\noptions.add_argument('disable-infobars')\noptions.add_argument('log-level=3')\noptions.add_argument(\"headless\")\n\n# launch Webdriver\nprint('Webdriver launching...')\ndriver = Edge(options=options)\n# driver = Edge(service=service, options=options)\nprint('Webdriver launched.')\n\nwith WeRead(driver,debug=True) as weread:\n    weread.login() #? login for grab the whole book\n    weread.scan2html('https://weread.qq.com/web/reader/2c632ef071a486a92c60226kc81322c012c81e728d9d180')\n    weread.scan2html('https://weread.qq.com/web/reader/a9c32f40717db77aa9c9171kc81322c012c81e728d9d180')\n```\n\n扫描结果样例：\n\n![](https://github.com/Algebra-FUN/WeReadScan/blob/master/example/sample.png?raw=true)\n\n几点说明：\n\n1.  webdriver 需要 `无头(headless)` 模式启动\n2.  只有登陆后，才能扫描完整的图书资源；若不登陆，也可以扫描部分无需解锁的部分\n\n## API Reference\n\n### WeRead\n\nWeReadScan.WeRead(headless_driver)\n\n`微信读书`网页代理，用于图书扫描\n\n#### Args\n\n-   headless_driver:\t设置了headless的Webdriver示例\n\n#### Returns\n\n-   WeReadInstance\n\n#### Usage\n\n```python\nchrome_options = ChromeOptions()\nchrome_options.add_argument('--headless')\nheadless_driver = Chrome(chrome_options=chrome_options)\nweread = WeRead(headless_driver)\n```\n\n### Login\n\nWeReadScan.WeRead.login(wait_turns=15)\n\n展示二维码以登陆微信读书\n\n#### Args\n\n-   wait_turns:\t登陆二维码等待扫描的等待轮数\n\n#### Usage\n\n```python\nweread.login()\n```\n\n### Scan2html\n\nWeReadScan.WeRead.scan2html(book_url, save_at='.', show_output=True)\n\n扫面`微信读书`的书籍转换为PDF并保存本地\n\n#### Args\n\n| 参数名              | 类型   | 默认值  | 描述                    |\n| ---------------- | ---- | ---- | --------------------- |\n| book_url         | str  | 必填   | 扫描目标书籍的URL            |\n| save_at          | str  | '.'  | 保存地址                  |\n| show_output      | bool | True | 是否在该方法函数结束时展示生成的PDF文件 |\n\n#### Usage\n\n```python\nweread.scan2html('https://weread.qq.com/web/reader/a57325c05c8ed3a57224187kc81322c012c81e728d9d180')\n```\n\n## Disclaimer\n\n-   本脚本仅限用于**已购**图书的爬取，用于私人学习目的，禁止用于商业目的和网上资源扩散，尊重微信读书方面的利益\n-   若User使用该脚本用于不当的目的，责任由使用者承担，作者概不负责\n\n## Stargazers over time\n\n[![Stargazers over time](https://starchart.cc/Algebra-FUN/WeReadScan.svg)](https://starchart.cc/Algebra-FUN/WeReadScan)\n      \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falgebra-fun%2Fwereadscan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falgebra-fun%2Fwereadscan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falgebra-fun%2Fwereadscan/lists"}