feat: Add DB
This commit is contained in:
20
.github/workflows/update-db.yml
vendored
Normal file
20
.github/workflows/update-db.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
name: Update DB
|
||||
|
||||
on:
|
||||
push: { branches: main }
|
||||
# schedule:
|
||||
# # Every day at 00:00AM
|
||||
# - cron: '0 0 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
update-db:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- run: npm install
|
||||
- run: npm run update-db
|
||||
- run: git add .
|
||||
- run: git commit -m "Auto updating db" || echo "Nothing to commit"
|
||||
- run: git push origin HEAD:main
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -127,4 +127,7 @@ venv.bak/
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
.pyre/
|
||||
|
||||
# Node
|
||||
node_modules/
|
||||
212
db/categories.json
Normal file
212
db/categories.json
Normal file
@@ -0,0 +1,212 @@
|
||||
{
|
||||
"count": 52,
|
||||
"entries": [
|
||||
{
|
||||
"name": "Animals",
|
||||
"slug": "animals"
|
||||
},
|
||||
{
|
||||
"name": "Anime",
|
||||
"slug": "anime"
|
||||
},
|
||||
{
|
||||
"name": "Anti-Malware",
|
||||
"slug": "anti-malware"
|
||||
},
|
||||
{
|
||||
"name": "Art & Design",
|
||||
"slug": "art-and-design"
|
||||
},
|
||||
{
|
||||
"name": "Authentication & Authorization",
|
||||
"slug": "authentication-and-authorization"
|
||||
},
|
||||
{
|
||||
"name": "Blockchain",
|
||||
"slug": "blockchain"
|
||||
},
|
||||
{
|
||||
"name": "Books",
|
||||
"slug": "books"
|
||||
},
|
||||
{
|
||||
"name": "Business",
|
||||
"slug": "business"
|
||||
},
|
||||
{
|
||||
"name": "Calendar",
|
||||
"slug": "calendar"
|
||||
},
|
||||
{
|
||||
"name": "Cloud Storage & File Sharing",
|
||||
"slug": "cloud-storage-and-file-sharing"
|
||||
},
|
||||
{
|
||||
"name": "Continuous Integration",
|
||||
"slug": "continuous-integration"
|
||||
},
|
||||
{
|
||||
"name": "Cryptocurrency",
|
||||
"slug": "cryptocurrency"
|
||||
},
|
||||
{
|
||||
"name": "Currency Exchange",
|
||||
"slug": "currency-exchange"
|
||||
},
|
||||
{
|
||||
"name": "Data Validation",
|
||||
"slug": "data-validation"
|
||||
},
|
||||
{
|
||||
"name": "Development",
|
||||
"slug": "development"
|
||||
},
|
||||
{
|
||||
"name": "Dictionaries",
|
||||
"slug": "dictionaries"
|
||||
},
|
||||
{
|
||||
"name": "Documents & Productivity",
|
||||
"slug": "documents-and-productivity"
|
||||
},
|
||||
{
|
||||
"name": "Email",
|
||||
"slug": "email"
|
||||
},
|
||||
{
|
||||
"name": "Entertainment",
|
||||
"slug": "entertainment"
|
||||
},
|
||||
{
|
||||
"name": "Environment",
|
||||
"slug": "environment"
|
||||
},
|
||||
{
|
||||
"name": "Events",
|
||||
"slug": "events"
|
||||
},
|
||||
{
|
||||
"name": "Finance",
|
||||
"slug": "finance"
|
||||
},
|
||||
{
|
||||
"name": "Food & Drink",
|
||||
"slug": "food-and-drink"
|
||||
},
|
||||
{
|
||||
"name": "Games & Comics",
|
||||
"slug": "games-and-comics"
|
||||
},
|
||||
{
|
||||
"name": "Geocoding",
|
||||
"slug": "geocoding"
|
||||
},
|
||||
{
|
||||
"name": "Government",
|
||||
"slug": "government"
|
||||
},
|
||||
{
|
||||
"name": "Health",
|
||||
"slug": "health"
|
||||
},
|
||||
{
|
||||
"name": "Jobs",
|
||||
"slug": "jobs"
|
||||
},
|
||||
{
|
||||
"name": "Machine Learning",
|
||||
"slug": "machine-learning"
|
||||
},
|
||||
{
|
||||
"name": "Music",
|
||||
"slug": "music"
|
||||
},
|
||||
{
|
||||
"name": "News",
|
||||
"slug": "news"
|
||||
},
|
||||
{
|
||||
"name": "Open Data",
|
||||
"slug": "open-data"
|
||||
},
|
||||
{
|
||||
"name": "Open Source Projects",
|
||||
"slug": "open-source-projects"
|
||||
},
|
||||
{
|
||||
"name": "Patent",
|
||||
"slug": "patent"
|
||||
},
|
||||
{
|
||||
"name": "Personality",
|
||||
"slug": "personality"
|
||||
},
|
||||
{
|
||||
"name": "Phone",
|
||||
"slug": "phone"
|
||||
},
|
||||
{
|
||||
"name": "Photography",
|
||||
"slug": "photography"
|
||||
},
|
||||
{
|
||||
"name": "Podcasts",
|
||||
"slug": "podcasts"
|
||||
},
|
||||
{
|
||||
"name": "Programming",
|
||||
"slug": "programming"
|
||||
},
|
||||
{
|
||||
"name": "Science & Math",
|
||||
"slug": "science-and-math"
|
||||
},
|
||||
{
|
||||
"name": "Security",
|
||||
"slug": "security"
|
||||
},
|
||||
{
|
||||
"name": "Shopping",
|
||||
"slug": "shopping"
|
||||
},
|
||||
{
|
||||
"name": "Social",
|
||||
"slug": "social"
|
||||
},
|
||||
{
|
||||
"name": "Sports & Fitness",
|
||||
"slug": "sports-and-fitness"
|
||||
},
|
||||
{
|
||||
"name": "Test Data",
|
||||
"slug": "test-data"
|
||||
},
|
||||
{
|
||||
"name": "Text Analysis",
|
||||
"slug": "text-analysis"
|
||||
},
|
||||
{
|
||||
"name": "Tracking",
|
||||
"slug": "tracking"
|
||||
},
|
||||
{
|
||||
"name": "Transportation",
|
||||
"slug": "transportation"
|
||||
},
|
||||
{
|
||||
"name": "URL Shorteners",
|
||||
"slug": "url-shorteners"
|
||||
},
|
||||
{
|
||||
"name": "Vehicle",
|
||||
"slug": "vehicle"
|
||||
},
|
||||
{
|
||||
"name": "Video",
|
||||
"slug": "video"
|
||||
},
|
||||
{
|
||||
"name": "Weather",
|
||||
"slug": "weather"
|
||||
}
|
||||
]}
|
||||
12827
db/resources.json
Normal file
12827
db/resources.json
Normal file
File diff suppressed because it is too large
Load Diff
513
package-lock.json
generated
Normal file
513
package-lock.json
generated
Normal file
@@ -0,0 +1,513 @@
|
||||
{
|
||||
"name": "public-apis",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "public-apis",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"remark-parse": "^9.0.0",
|
||||
"unified": "^9.2.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/mdast": {
|
||||
"version": "3.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.10.tgz",
|
||||
"integrity": "sha512-W864tg/Osz1+9f4lrGTZpCSO5/z4608eUp19tbozkq2HJK6i3z1kT0H9tlADXuYIb1YYOBByU4Jsqkk75q48qA==",
|
||||
"dependencies": {
|
||||
"@types/unist": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/unist": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz",
|
||||
"integrity": "sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ=="
|
||||
},
|
||||
"node_modules/bail": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/bail/-/bail-1.0.5.tgz",
|
||||
"integrity": "sha512-xFbRxM1tahm08yHBP16MMjVUAvDaBMD38zsM9EMAUN61omwLmKlOpB/Zku5QkjZ8TZ4vn53pj+t518cH0S03RQ==",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/wooorm"
|
||||
}
|
||||
},
|
||||
"node_modules/character-entities": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.4.tgz",
|
||||
"integrity": "sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw==",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/wooorm"
|
||||
}
|
||||
},
|
||||
"node_modules/character-entities-legacy": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.4.tgz",
|
||||
"integrity": "sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA==",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/wooorm"
|
||||
}
|
||||
},
|
||||
"node_modules/character-reference-invalid": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz",
|
||||
"integrity": "sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/wooorm"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
|
||||
"dependencies": {
|
||||
"ms": "2.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/extend": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
|
||||
"integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g=="
|
||||
},
|
||||
"node_modules/is-alphabetical": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.4.tgz",
|
||||
"integrity": "sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/wooorm"
|
||||
}
|
||||
},
|
||||
"node_modules/is-alphanumerical": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.4.tgz",
|
||||
"integrity": "sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==",
|
||||
"dependencies": {
|
||||
"is-alphabetical": "^1.0.0",
|
||||
"is-decimal": "^1.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/wooorm"
|
||||
}
|
||||
},
|
||||
"node_modules/is-buffer": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz",
|
||||
"integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/is-decimal": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.4.tgz",
|
||||
"integrity": "sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw==",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/wooorm"
|
||||
}
|
||||
},
|
||||
"node_modules/is-hexadecimal": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz",
|
||||
"integrity": "sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/wooorm"
|
||||
}
|
||||
},
|
||||
"node_modules/is-plain-obj": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz",
|
||||
"integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/mdast-util-from-markdown": {
|
||||
"version": "0.8.5",
|
||||
"resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.5.tgz",
|
||||
"integrity": "sha512-2hkTXtYYnr+NubD/g6KGBS/0mFmBcifAsI0yIWRiRo0PjVs6SSOSOdtzbp6kSGnShDN6G5aWZpKQ2lWRy27mWQ==",
|
||||
"dependencies": {
|
||||
"@types/mdast": "^3.0.0",
|
||||
"mdast-util-to-string": "^2.0.0",
|
||||
"micromark": "~2.11.0",
|
||||
"parse-entities": "^2.0.0",
|
||||
"unist-util-stringify-position": "^2.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
},
|
||||
"node_modules/mdast-util-from-markdown/node_modules/parse-entities": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-2.0.0.tgz",
|
||||
"integrity": "sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==",
|
||||
"dependencies": {
|
||||
"character-entities": "^1.0.0",
|
||||
"character-entities-legacy": "^1.0.0",
|
||||
"character-reference-invalid": "^1.0.0",
|
||||
"is-alphanumerical": "^1.0.0",
|
||||
"is-decimal": "^1.0.0",
|
||||
"is-hexadecimal": "^1.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/wooorm"
|
||||
}
|
||||
},
|
||||
"node_modules/mdast-util-to-string": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-2.0.0.tgz",
|
||||
"integrity": "sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w==",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
},
|
||||
"node_modules/micromark": {
|
||||
"version": "2.11.4",
|
||||
"resolved": "https://registry.npmjs.org/micromark/-/micromark-2.11.4.tgz",
|
||||
"integrity": "sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "GitHub Sponsors",
|
||||
"url": "https://github.com/sponsors/unifiedjs"
|
||||
},
|
||||
{
|
||||
"type": "OpenCollective",
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"debug": "^4.0.0",
|
||||
"parse-entities": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/micromark/node_modules/parse-entities": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-2.0.0.tgz",
|
||||
"integrity": "sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==",
|
||||
"dependencies": {
|
||||
"character-entities": "^1.0.0",
|
||||
"character-entities-legacy": "^1.0.0",
|
||||
"character-reference-invalid": "^1.0.0",
|
||||
"is-alphanumerical": "^1.0.0",
|
||||
"is-decimal": "^1.0.0",
|
||||
"is-hexadecimal": "^1.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/wooorm"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
},
|
||||
"node_modules/remark-parse": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-9.0.0.tgz",
|
||||
"integrity": "sha512-geKatMwSzEXKHuzBNU1z676sGcDcFoChMK38TgdHJNAYfFtsfHDQG7MoJAjs6sgYMqyLduCYWDIWZIxiPeafEw==",
|
||||
"dependencies": {
|
||||
"mdast-util-from-markdown": "^0.8.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
},
|
||||
"node_modules/trough": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/trough/-/trough-1.0.5.tgz",
|
||||
"integrity": "sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/wooorm"
|
||||
}
|
||||
},
|
||||
"node_modules/unified": {
|
||||
"version": "9.2.2",
|
||||
"resolved": "https://registry.npmjs.org/unified/-/unified-9.2.2.tgz",
|
||||
"integrity": "sha512-Sg7j110mtefBD+qunSLO1lqOEKdrwBFBrR6Qd8f4uwkhWNlbkaqwHse6e7QvD3AP/MNoJdEDLaf8OxYyoWgorQ==",
|
||||
"dependencies": {
|
||||
"bail": "^1.0.0",
|
||||
"extend": "^3.0.0",
|
||||
"is-buffer": "^2.0.0",
|
||||
"is-plain-obj": "^2.0.0",
|
||||
"trough": "^1.0.0",
|
||||
"vfile": "^4.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
},
|
||||
"node_modules/unist-util-stringify-position": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-2.0.3.tgz",
|
||||
"integrity": "sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==",
|
||||
"dependencies": {
|
||||
"@types/unist": "^2.0.2"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
},
|
||||
"node_modules/vfile": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/vfile/-/vfile-4.2.1.tgz",
|
||||
"integrity": "sha512-O6AE4OskCG5S1emQ/4gl8zK586RqA3srz3nfK/Viy0UPToBc5Trp9BVFb1u0CjsKrAWwnpr4ifM/KBXPWwJbCA==",
|
||||
"dependencies": {
|
||||
"@types/unist": "^2.0.0",
|
||||
"is-buffer": "^2.0.0",
|
||||
"unist-util-stringify-position": "^2.0.0",
|
||||
"vfile-message": "^2.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
},
|
||||
"node_modules/vfile-message": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-2.0.4.tgz",
|
||||
"integrity": "sha512-DjssxRGkMvifUOJre00juHoP9DPWuzjxKuMDrhNbk2TdaYYBNMStsNhEOt3idrtI12VQYM/1+iM0KOzXi4pxwQ==",
|
||||
"dependencies": {
|
||||
"@types/unist": "^2.0.0",
|
||||
"unist-util-stringify-position": "^2.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/mdast": {
|
||||
"version": "3.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.10.tgz",
|
||||
"integrity": "sha512-W864tg/Osz1+9f4lrGTZpCSO5/z4608eUp19tbozkq2HJK6i3z1kT0H9tlADXuYIb1YYOBByU4Jsqkk75q48qA==",
|
||||
"requires": {
|
||||
"@types/unist": "*"
|
||||
}
|
||||
},
|
||||
"@types/unist": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz",
|
||||
"integrity": "sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ=="
|
||||
},
|
||||
"bail": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/bail/-/bail-1.0.5.tgz",
|
||||
"integrity": "sha512-xFbRxM1tahm08yHBP16MMjVUAvDaBMD38zsM9EMAUN61omwLmKlOpB/Zku5QkjZ8TZ4vn53pj+t518cH0S03RQ=="
|
||||
},
|
||||
"character-entities": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.4.tgz",
|
||||
"integrity": "sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw=="
|
||||
},
|
||||
"character-entities-legacy": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.4.tgz",
|
||||
"integrity": "sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA=="
|
||||
},
|
||||
"character-reference-invalid": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz",
|
||||
"integrity": "sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg=="
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
|
||||
"requires": {
|
||||
"ms": "2.1.2"
|
||||
}
|
||||
},
|
||||
"extend": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
|
||||
"integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g=="
|
||||
},
|
||||
"is-alphabetical": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.4.tgz",
|
||||
"integrity": "sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg=="
|
||||
},
|
||||
"is-alphanumerical": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.4.tgz",
|
||||
"integrity": "sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==",
|
||||
"requires": {
|
||||
"is-alphabetical": "^1.0.0",
|
||||
"is-decimal": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"is-buffer": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz",
|
||||
"integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ=="
|
||||
},
|
||||
"is-decimal": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.4.tgz",
|
||||
"integrity": "sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw=="
|
||||
},
|
||||
"is-hexadecimal": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz",
|
||||
"integrity": "sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw=="
|
||||
},
|
||||
"is-plain-obj": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz",
|
||||
"integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA=="
|
||||
},
|
||||
"mdast-util-from-markdown": {
|
||||
"version": "0.8.5",
|
||||
"resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.5.tgz",
|
||||
"integrity": "sha512-2hkTXtYYnr+NubD/g6KGBS/0mFmBcifAsI0yIWRiRo0PjVs6SSOSOdtzbp6kSGnShDN6G5aWZpKQ2lWRy27mWQ==",
|
||||
"requires": {
|
||||
"@types/mdast": "^3.0.0",
|
||||
"mdast-util-to-string": "^2.0.0",
|
||||
"micromark": "~2.11.0",
|
||||
"parse-entities": "^2.0.0",
|
||||
"unist-util-stringify-position": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"parse-entities": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-2.0.0.tgz",
|
||||
"integrity": "sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==",
|
||||
"requires": {
|
||||
"character-entities": "^1.0.0",
|
||||
"character-entities-legacy": "^1.0.0",
|
||||
"character-reference-invalid": "^1.0.0",
|
||||
"is-alphanumerical": "^1.0.0",
|
||||
"is-decimal": "^1.0.0",
|
||||
"is-hexadecimal": "^1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"mdast-util-to-string": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-2.0.0.tgz",
|
||||
"integrity": "sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w=="
|
||||
},
|
||||
"micromark": {
|
||||
"version": "2.11.4",
|
||||
"resolved": "https://registry.npmjs.org/micromark/-/micromark-2.11.4.tgz",
|
||||
"integrity": "sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==",
|
||||
"requires": {
|
||||
"debug": "^4.0.0",
|
||||
"parse-entities": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"parse-entities": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-2.0.0.tgz",
|
||||
"integrity": "sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==",
|
||||
"requires": {
|
||||
"character-entities": "^1.0.0",
|
||||
"character-entities-legacy": "^1.0.0",
|
||||
"character-reference-invalid": "^1.0.0",
|
||||
"is-alphanumerical": "^1.0.0",
|
||||
"is-decimal": "^1.0.0",
|
||||
"is-hexadecimal": "^1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
},
|
||||
"remark-parse": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-9.0.0.tgz",
|
||||
"integrity": "sha512-geKatMwSzEXKHuzBNU1z676sGcDcFoChMK38TgdHJNAYfFtsfHDQG7MoJAjs6sgYMqyLduCYWDIWZIxiPeafEw==",
|
||||
"requires": {
|
||||
"mdast-util-from-markdown": "^0.8.0"
|
||||
}
|
||||
},
|
||||
"trough": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/trough/-/trough-1.0.5.tgz",
|
||||
"integrity": "sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA=="
|
||||
},
|
||||
"unified": {
|
||||
"version": "9.2.2",
|
||||
"resolved": "https://registry.npmjs.org/unified/-/unified-9.2.2.tgz",
|
||||
"integrity": "sha512-Sg7j110mtefBD+qunSLO1lqOEKdrwBFBrR6Qd8f4uwkhWNlbkaqwHse6e7QvD3AP/MNoJdEDLaf8OxYyoWgorQ==",
|
||||
"requires": {
|
||||
"bail": "^1.0.0",
|
||||
"extend": "^3.0.0",
|
||||
"is-buffer": "^2.0.0",
|
||||
"is-plain-obj": "^2.0.0",
|
||||
"trough": "^1.0.0",
|
||||
"vfile": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"unist-util-stringify-position": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-2.0.3.tgz",
|
||||
"integrity": "sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==",
|
||||
"requires": {
|
||||
"@types/unist": "^2.0.2"
|
||||
}
|
||||
},
|
||||
"vfile": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/vfile/-/vfile-4.2.1.tgz",
|
||||
"integrity": "sha512-O6AE4OskCG5S1emQ/4gl8zK586RqA3srz3nfK/Viy0UPToBc5Trp9BVFb1u0CjsKrAWwnpr4ifM/KBXPWwJbCA==",
|
||||
"requires": {
|
||||
"@types/unist": "^2.0.0",
|
||||
"is-buffer": "^2.0.0",
|
||||
"unist-util-stringify-position": "^2.0.0",
|
||||
"vfile-message": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"vfile-message": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-2.0.4.tgz",
|
||||
"integrity": "sha512-DjssxRGkMvifUOJre00juHoP9DPWuzjxKuMDrhNbk2TdaYYBNMStsNhEOt3idrtI12VQYM/1+iM0KOzXi4pxwQ==",
|
||||
"requires": {
|
||||
"@types/unist": "^2.0.0",
|
||||
"unist-util-stringify-position": "^2.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
20
package.json
Normal file
20
package.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "public-apis",
|
||||
"description": "A collaborative list of public APIs for developers",
|
||||
"scripts": {
|
||||
"update-db": "node scripts/db/update-db.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/public-apis-dev/public-apis.git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/public-apis-dev/public-apis#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/public-apis-dev/public-apis/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"remark-parse": "^9.0.0",
|
||||
"unified": "^9.2.2"
|
||||
}
|
||||
}
|
||||
47
scripts/db/update-db.js
Normal file
47
scripts/db/update-db.js
Normal file
@@ -0,0 +1,47 @@
|
||||
const fs = require('fs')
|
||||
const remarkParse = require('remark-parse')
|
||||
const unified = require('unified')
|
||||
|
||||
const formatCategories = require('../../utils/db/format-categories')
|
||||
const formatJson = require('../../utils/db/format-json')
|
||||
const formatResources = require('../../utils/db/format-resources')
|
||||
const groupRowContent = require('../../utils/db/group-row-content')
|
||||
const separateTables = require('../../utils/db/separate-tables')
|
||||
const writeToFile = require('../../utils/db/write-to-file')
|
||||
|
||||
async function updateDB() {
|
||||
try {
|
||||
const readme = fs.readFileSync('./README.md', 'utf-8', (err, data) => {
|
||||
if (err) throw err
|
||||
readme = data
|
||||
})
|
||||
|
||||
const parsedReadme = unified().use(remarkParse).parse(readme).children
|
||||
const indexListIndex = parsedReadme.findIndex(child => child.type === 'list')
|
||||
|
||||
// Create resources list
|
||||
const separatedTables = separateTables({ readme: parsedReadme, indexListIndex })
|
||||
const tablesWithGroupedRowContent = groupRowContent(separatedTables)
|
||||
const formattedContent = formatResources(tablesWithGroupedRowContent)
|
||||
|
||||
await writeToFile({
|
||||
data: formatJson(formattedContent),
|
||||
filePath: './db/resources.json',
|
||||
})
|
||||
|
||||
// Create categories list
|
||||
const categories = parsedReadme[indexListIndex].children.map(
|
||||
category => category.children[0].children[0].children[0].value
|
||||
)
|
||||
const categoriesList = formatCategories(categories)
|
||||
|
||||
await writeToFile({
|
||||
data: formatJson(categoriesList),
|
||||
filePath: './db/categories.json',
|
||||
})
|
||||
} catch (error) {
|
||||
throw new Error('Error creating DB files:', error)
|
||||
}
|
||||
}
|
||||
|
||||
updateDB()
|
||||
11
utils/db/format-categories.js
Normal file
11
utils/db/format-categories.js
Normal file
@@ -0,0 +1,11 @@
|
||||
module.exports = function (categories) {
|
||||
return categories.map(category => ({
|
||||
name: category,
|
||||
slug: category
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.replace(/&/g, 'and')
|
||||
.replace(/[^A-Z0-9/]+/gi, '-')
|
||||
.replace(/\s/g, '-'),
|
||||
}))
|
||||
}
|
||||
3
utils/db/format-json.js
Normal file
3
utils/db/format-json.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = function (entries) {
|
||||
return `{\n"count": ${entries.length},\n"entries": ${JSON.stringify(entries, null, 4)}}`
|
||||
}
|
||||
22
utils/db/format-resources.js
Normal file
22
utils/db/format-resources.js
Normal file
@@ -0,0 +1,22 @@
|
||||
module.exports = function (tables) {
|
||||
return tables
|
||||
.map(({ name: categoryName, rows }) => {
|
||||
return rows.map(({ link, name: entryName, description: rawDescription }) => {
|
||||
const [description, auth, https, cors] = rawDescription
|
||||
.split('|')
|
||||
.map(item => item.trim())
|
||||
.filter(item => item)
|
||||
|
||||
return {
|
||||
API: entryName,
|
||||
Description: description,
|
||||
Auth: auth?.toLowerCase() === 'no' ? '' : auth,
|
||||
HTTPS: https?.toLowerCase() === 'yes' ? true : false,
|
||||
Cors: cors?.toLowerCase(),
|
||||
Link: link,
|
||||
Category: categoryName,
|
||||
}
|
||||
})
|
||||
})
|
||||
.flat()
|
||||
}
|
||||
25
utils/db/group-row-content.js
Normal file
25
utils/db/group-row-content.js
Normal file
@@ -0,0 +1,25 @@
|
||||
module.exports = function (tables) {
|
||||
return tables.map(({ name, rows }) => {
|
||||
const content = []
|
||||
|
||||
rows.forEach((child, i) => {
|
||||
if (i === 0) return // Table header
|
||||
|
||||
if (child.type === 'link') {
|
||||
content.push({
|
||||
link: child.url,
|
||||
name: child.children[0].value,
|
||||
description: '',
|
||||
})
|
||||
} else {
|
||||
const lastContentItem = content.pop()
|
||||
content.push({
|
||||
...lastContentItem,
|
||||
description: `${lastContentItem.description} ${child.value}`,
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
return { name, rows: content }
|
||||
})
|
||||
}
|
||||
14
utils/db/separate-tables.js
Normal file
14
utils/db/separate-tables.js
Normal file
@@ -0,0 +1,14 @@
|
||||
module.exports = function ({ readme, indexListIndex }) {
|
||||
return readme
|
||||
.map((child, i) => {
|
||||
if (i <= indexListIndex) return
|
||||
|
||||
if (child.type === 'heading' && child.depth === 3) {
|
||||
const name = child.children[0].value
|
||||
const rows = readme[i + 1].children
|
||||
|
||||
return { name, rows }
|
||||
}
|
||||
})
|
||||
.filter(table => table)
|
||||
}
|
||||
11
utils/db/write-to-file.js
Normal file
11
utils/db/write-to-file.js
Normal file
@@ -0,0 +1,11 @@
|
||||
const fs = require('fs')
|
||||
|
||||
module.exports = async function ({ data, filePath }) {
|
||||
await fs.writeFile(filePath, data, error => {
|
||||
if (error) {
|
||||
throw new Error(`Error writing to file: ${error}`)
|
||||
}
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user