https://github.com/xtream1101/parser-api
Api endpoints to parse various things
https://github.com/xtream1101/parser-api
Last synced: 12 months ago
JSON representation
Api endpoints to parse various things
- Host: GitHub
- URL: https://github.com/xtream1101/parser-api
- Owner: xtream1101
- License: mit
- Created: 2017-05-05T18:33:26.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-08T20:40:32.000Z (about 9 years ago)
- Last Synced: 2025-01-18T09:40:15.328Z (over 1 year ago)
- Language: Python
- Size: 71.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Api for parsing things
## Running
`$ pip3 install -r requirements.txt`
`$ gunicorn api:app`
### URL
Parse a full url into its smallest parts
Endpoint: `/parse/url?url={value}`
Example:
Input url: `https://user:pass@test.example.com:8080/foo/bar?arg1=a&arg2=&arg3=hi&arg4&arg3=hello#pg5`
Input url after encoding (this gets passed as the arg): `https%3A%2F%2Fuser%3Apass%40test.example.com%3A8080%2Ffoo%2Fbar%3Farg1%3Da%26arg2%3D%26arg3%3Dhi%26arg4%26arg3%3Dhello%23pg5`
Response:
```
{
input: "https://user:pass@test.example.com:8080/foo/bar?arg1=a&arg2=&arg3=hi&arg4&arg3=hello#pg5",
valid_tld: true,
parts: {
protocol: "https",
username: "user",
password: "pass",
hash: "#pg5",
subdomains: [
"test"
],
rootdomain: "example",
suffix: "com",
port: "8080",
endpoint: "/foo/bar",
args: {
arg1: "a",
arg2: "",
arg3: [
"hi",
"hello"
],
arg4: ""
}
}
}
```
* Currently only works with urls that have a valid tld (top level domain). TODO: Get to work with ip's and other hostnames i.e. localhost