Skip to main content

Lazy simple command line tool, a swiss knife for scraper writers. Automates scraping so much as possible

Project description

About Lazyscraper

Lazyscraper is a simple command line tool and library, a swiss knife for scraper writers. It’s created to work only from command line and to make easier scraper writing for very simple tasks like extraction of external urls or simple table.

Supported patterns

  • simpleul - Extracts list of urls with pattern ul/li/a. Returns array of urls with “_text” and “href” fields

  • simpleopt - Extracts list of options values with pattern select/option. Returns array: “_text”, “value”

  • exturls - Extracts list of urls that leads to external websites. Returns array of urls with “_text” and “href” fields

  • getforms - Extracts all forms from website. Returns complex JSON data with each form on the page

Command-line tool



Show this message and exit.

Commands: * extract Extract data with xpath * gettable Extracts table with data from html * use Uses predefined pattern to extract page data


Extracts list of photos and names of Russian government ministers and outputs it to “gov_persons.csv”

python extract –url –xpath “//img[@class=’photo’]” –fieldnames src,srcset,alt –absolutize True –output gov_persons.csv –format csv

Extracts list of ministries from Russian government website using pattern “simpleul” and from UL tag with class “departments col col__wide” and outputs absolutized urls.

python use –pattern simpleul –nodeclass “departments col col__wide” –url –absolutize True

Extracts list of territorial organizations urls from Russian tax service website using pattern “simpleopt”.

python use –pattern simpleopt –url

Extracts all forms from Russian tax service website using pattern “getforms”. Returns JSON with each form and each button, input and select

python use –pattern getforms –url

Extracts list of websites urls of Russian Federal Treasury and uses awk to extract domains.

python extract –url –xpath “//ul[@class=’site-list’]/li/a” –fieldnames href | awk -F/ ‘{print $3}’

How to use library

Extracts all urls with fields: src, alt, href and _text from website
>>> from lazyscraper import extract_data_xpath
>>> extract_data_xpath('', xpath='//a', fieldnames='src,alt,href,_text', absolutize=True)
Run pattern ‘simpleopt’ against Russian federal treasury website
>>> from lazyscraper import use_pattern
>>> use_pattern('', 'simpleopt')


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lazyscraper-0.1.2.tar.gz (8.0 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page