urlp
A simple command-line utility for parsing URLs, written in Python. Inspired by urlp.
$ urlp --host "http://www.cnn.com/service/alert.jsp?s=cnn&v=a"
www.cnn.com
$ urlp --registered_domain "http://www.cnn.com/service/alert.jsp?s=cnn&v=a"
cnn.com
$ urlp --path "http://www.cnn.com/service/alert.jsp?s=cnn&v=a"
/service/alert.jsp
$ urlp --path -i 0 "http://www.cnn.com/service/alert.jsp?s=cnn&v=a"
service
$ urlp --query "http://www.cnn.com/service/alert.jsp?s=cnn&v=a"
s=cnn&v=a
$ urlp --query --query_field=s "http://www.cnn.com/service/alert.jsp?s=cnn&v=a"
cnn
urlp often works together with other unix command-line tools. For example:
- Find all hosts in urls, sorted by count.
cat urlfile | urlp --host | sort | uniq -c | sort -nr -k1,1
- Find all url path words (separated by "/"), sorted by count.
cat urlfile | urlp --path | tr / \\n | awk '$1!=""' | sort | uniq -c | sort -nr -k1,1
Install
pip install urlp
Usage
$ urlp --help
usage: urlp [-h] [--host] [-p] [-i path_index] [-q] [-k query_field] [-r]
[urls [urls ...]]
A command line url parser
positional arguments:
urls URLs to parse
optional arguments:
-h, --help show this help message and exit
--host hostname
-p, --path Path
-i path_index, --path_index path_index
filter parsed path by index
-q, --query query string
-k query_field, --query_field query_field
value for the specified query field
-r, --registered_domain
registered domain
Metadata
Release files for urlp 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| urlp-0.0.3.tar.gz | 3.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| urlp-0.0.3-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 6.3 kB
Release files / urlp-0.0.3.tar.gz
| Download URL | urlp-0.0.3.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f4b12d3bc235d823811d7e734b58b3f7e573e3e7d0e3334e9dc7cb9552fd802
|
|
BLAKE2b-256 checksum How to use checksums |
e6cf06f6315a19256a344113cd8f74ef3d776020534bdb486de535dfb6169281
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
|
Release files / urlp-0.0.3-py2.py3-none-any.whl
| Download URL | urlp-0.0.3-py2.py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
16a15ba04f757a6893af4accbcf7802ad376c414de9ffec92b0334b4d8a780fa
|
|
BLAKE2b-256 checksum How to use checksums |
6c46597d9784ce7772546eafabd15b213cda4a75f09d32658451eb0d5039708e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
|