[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-10310":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":23,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":33,"readmeContent":34,"aiSummary":35,"trendingCount":16,"starSnapshotCount":16,"syncStatus":36,"lastSyncTime":37,"discoverSource":38},10310,"toapi","elliotgao2\u002Ftoapi","elliotgao2","Every web site provides APIs.","https:\u002F\u002Fgaojiuli.github.io\u002Ftoapi\u002F",null,"Python",3552,240,72,9,0,1,5,29.15,"MIT License",false,"master",true,[25,26,27,28,29,30,31,5,32],"api","crawler","flask","html","json","python","spider","web","2026-06-12 02:02:19","# Toapi\n\n[![Build](https:\u002F\u002Ftravis-ci.org\u002Fgaojiuli\u002Ftoapi.svg?branch=master)](https:\u002F\u002Ftravis-ci.org\u002Fgaojiuli\u002Ftoapi)\n[![Coverage](https:\u002F\u002Fcodecov.io\u002Fgh\u002Fgaojiuli\u002Ftoapi\u002Fbranch\u002Fmaster\u002Fgraph\u002Fbadge.svg)](https:\u002F\u002Fcodecov.io\u002Fgh\u002Fgaojiuli\u002Ftoapi)\n[![Python](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fpyversions\u002Ftoapi.svg)](https:\u002F\u002Fpypi.python.org\u002Fpypi\u002Ftoapi\u002F)\n[![Version](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Ftoapi.svg)](https:\u002F\u002Fpypi.python.org\u002Fpypi\u002Ftoapi\u002F)\n[![License](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fl\u002Ftoapi.svg)](https:\u002F\u002Fpypi.python.org\u002Fpypi\u002Ftoapi\u002F)\n\n## Overview\n\nToapi give you the ability to make every web site provides APIs.\n\n- v1.0.0 Documentation: [http:\u002F\u002Fwww.toapi.org](http:\u002F\u002Fwww.toapi.org)\n- Awesome: [https:\u002F\u002Fgithub.com\u002Ftoapi\u002Fawesome-toapi](https:\u002F\u002Fgithub.com\u002Ftoapi\u002Fawesome-toapi)\n- Organization: [https:\u002F\u002Fgithub.com\u002Ftoapi](https:\u002F\u002Fgithub.com\u002Ftoapi)\n\n## Features\n\n- Automatic converting HTML web site to API service.\n- Automatic caching every page of source site.\n- Automatic caching every request.\n- Support merging multiple web sites into one API service. \n\n## Get Started\n\n### Installation\n\n```text\n$ pip install toapi\n```\n\n### Usage\n\ncreate `app.py` and copy the code:\n\n```python\nfrom flask import request\nfrom htmlparsing import Attr, Text\nfrom toapi import Api, Item\n\napi = Api()\n\n\n@api.site('https:\u002F\u002Fnews.ycombinator.com')\n@api.list('.athing')\n@api.route('\u002Fposts?page={page}', '\u002Fnews?p={page}')\n@api.route('\u002Fposts', '\u002Fnews?p=1')\nclass Post(Item):\n    url = Attr('.storylink', 'href')\n    title = Text('.storylink')\n\n\n@api.site('https:\u002F\u002Fnews.ycombinator.com')\n@api.route('\u002Fposts?page={page}', '\u002Fnews?p={page}')\n@api.route('\u002Fposts', '\u002Fnews?p=1')\nclass Page(Item):\n    next_page = Attr('.morelink', 'href')\n\n    def clean_next_page(self, value):\n        return api.convert_string('\u002F' + value, '\u002Fnews?p={page}', request.host_url.strip('\u002F') + '\u002Fposts?page={page}')\n\n\napi.run(debug=True, host='0.0.0.0', port=5000)\n```\n\nrun `python app.py`\n\nthen open your browser and visit `http:\u002F\u002F127.0.0.1:5000\u002Fposts?page=1` \n\nyou will get the result like:\n\n```json\n{\n  \"Page\": {\n    \"next_page\": \"http:\u002F\u002F127.0.0.1:5000\u002Fposts?page=2\"\n  }, \n  \"Post\": [\n    {\n      \"title\": \"Mathematicians Crack the Cursed Curve\", \n      \"url\": \"https:\u002F\u002Fwww.quantamagazine.org\u002Fmathematicians-crack-the-cursed-curve-20171207\u002F\"\n    }, \n    {\n      \"title\": \"Stuffing a Tesla Drivetrain into a 1981 Honda Accord\", \n      \"url\": \"https:\u002F\u002Fjalopnik.com\u002Fthis-glorious-madman-stuffed-a-p85-tesla-drivetrain-int-1823461909\"\n    }\n  ]\n}\n```\n\n\n## Contributing\n\nWrite code and test code and pull request.\n\n\n\n","Toapi 是一个能够将任何网站转换为API服务的Python库。其核心功能包括自动将HTML网页转换为API服务、自动缓存源站点的每一页以及每个请求，并支持将多个网站合并成一个API服务。它基于Flask框架构建，使用简单的配置即可快速生成API接口。适用于需要从非API化的网站中提取数据并以结构化形式（如JSON）输出的场景，比如数据抓取、内容聚合等任务。",2,"2026-06-11 03:27:43","top_topic"]