Links-Extractor
Extract all internal and external links from a URL in Python.
Description
Links-Extractor fetches one or more web pages and lists the internal and external hyperlinks found on each page. A link is treated as internal when its host matches the host of the page being scanned, and external otherwise. Empty anchors and javascript:, mailto:, and tel: links are ignored.
Install
pip install links-extractor
This installs the links-extractor command. You can also run the script directly from a clone (python3 extractor.py ...).
Requirements
- Python 3
- Dependencies:
requests,beautifulsoup4,lxml
Install them with:
pip install -r requirements.txt
Usage
Pass one or more URLs as arguments:
links-extractor https://example.com
python3 extractor.py https://example.com
python3 extractor.py https://example.com https://www.python.org
Redirect the output to a file:
python3 extractor.py https://example.com > out.txt
For each URL the script prints the count and list of internal links followed by the count and list of external links.
A full write-up is available at http://com.puter.tips/2016/12/extract-all-internal-and-external-links.html
You may also find the companion project useful: https://github.com/com-puter-tips/SEO-Analysis
Citation
If you use this software, please cite it using the metadata in CITATION.cff.
License
Distributed under the GNU General Public License v3.0. See LICENSE.
Metadata
Release files for links-extractor-cli 1.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| links_extractor_cli-1.4.0.tar.gz | 15.4 kB | Without provenance | Details for links_extractor_cli-1.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| links_extractor_cli-1.4.0-py3-none-any.whl | Python 3 | none | any | Details for links_extractor_cli-1.4.0-py3-none-any.whl |
Total release size: 31.3 kB
Release files / links_extractor_cli-1.4.0.tar.gz
| Download URL | links_extractor_cli-1.4.0.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4dc28ea9112795245437dfc8fd5e538d393b5428eee0b194107ea3541891a1a2
|
|
BLAKE2b-256 checksum How to use checksums |
50090df1498d546e72e1a5ba3706fe3204312cbb58de7d0d92caa812d0bd3602
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Release files / links_extractor_cli-1.4.0-py3-none-any.whl
| Download URL | links_extractor_cli-1.4.0-py3-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
25149e6d91c0ece2cc46aee16d2e4e5cf97262136c8bbe62037b17bd955b40b4
|
|
BLAKE2b-256 checksum How to use checksums |
c63120698d2c8c61c97db36a480e59490ebef58b0466405c8d58139e19460549
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Security for links-extractor-cli 1.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.