Site Map Parser
Script and library which reads urls and converts to objects, allows exporting as CSV or JSON.
Handle sitemaps according to: https://www.sitemaps.org/protocol.html
Installation
pip install site-map-parser
Usage
Script usage
smapper $url > /tmp/data.csv
Logs written to ~/sitemap_run.log
Arguments
| Argument | Options | Default | Information |
|---|---|---|---|
| -h | N/A | N/A | Outputs argument data |
| url | e.g. http://www.example.com - http://www.example.com/other_sitemap.xml |
N/A | Required - sitemap data to retrieve |
| -l, --log | CRITICAL or ERROR or WARNING or INFO or DEBUG |
INFO |
logs to sitemapper_run.log in install folder |
| -e, --exporter | csv or json |
csv |
Export format of the data |
Library Usage
from sitemapparser import SiteMapParser
sm = SiteMapParser('http://www.example.com') # reads /sitemap.xml
if sm.has_sitemaps():
sitemaps = sm.get_sitemaps() # returns iterator of sitemapper.Sitemap instances
else:
urls = sm.get_urls() # returns iterator of sitemapper.Url instances
Exporting
Two exporters are available: csv and json
CSV Exporter
from sitemapparser.exporters import CSVExporter
# sm set as per earlier library usage example
csv_exporter = CSVExporter(sm)
if sm.has_sitemaps():
print(csv_exporter.export_sitemaps())
elif sm.has_urls():
print(csv_exporter.export_urls())
JSON Exporter
from sitemapparser.exporters import JSONExporter
# sm set as per earlier library usage example
json_exporter = JSONExporter(sm)
if sm.has_sitemaps():
print(json_exporter.export_sitemaps())
elif sm.has_urls():
print(json_exporter.export_urls())
Metadata
Release files for site-map-parser 0.3.9
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 |
|---|---|---|---|---|
| site-map-parser-0.3.9.tar.gz | 7.7 kB | Without provenance | Details for site-map-parser-0.3.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| site_map_parser-0.3.9-py3-none-any.whl | Python 3 | none | any | Details for site_map_parser-0.3.9-py3-none-any.whl |
Total release size: 19.0 kB
Release files / site-map-parser-0.3.9.tar.gz
| Download URL | site-map-parser-0.3.9.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
306f92df5c4d17e73f4a132ebf4925741695ba3a23139fc2c30d015938d67a95
|
|
BLAKE2b-256 checksum How to use checksums |
64837cf82e87bb0fe2f893086f9ccf16cd041aa5ee331468ac51b6f899a4f903
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.4
|
Release files / site_map_parser-0.3.9-py3-none-any.whl
| Download URL | site_map_parser-0.3.9-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8c6bba0e36189a8e6787ab4d41e769538cc4e94f1e179e09ed6c1e0af5fc3000
|
|
BLAKE2b-256 checksum How to use checksums |
1cc0efef8242d4cab1263aea30e4d0ac985278ae32ee62bb815c6e2c92b0edcf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.4
|
Security for site-map-parser 0.3.9
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.