GithubHelp home page GithubHelp logo

lil-scraper's Introduction

Lil' Scraper

lil-scraper is a small CLI tool to quickly scrape short snippets of text data from multiple HTTP sources.

Installation

Quickest way to install lil-scraper is using the provided install.sh script:

curl -LSfs https://walterbm.github.io/lil-scraper/install.sh | sh -s

Alternatively you can download the most recent binary from the Github release artifacts

Usage

Feed lil-scraper a list of urls (one url per line) from stdin and pass in a regular expression pattern with a capture group to search for:

cat urls.txt | lil-scraper  --pattern '<i lang="es">([^<]+)</i>'

This is roughly equivalent to running a similar command using xargs however lil-scraper will run significantly faster thanks to the tokio async runtime.

cat urls.txt | xargs -P 0 curl | grep -ioE '<i lang="es">([^<]+)</i>'

The lil-scraper can also search and match on response headers. Headers are normalized to match the curl standard (i.e. lowercased and prepended with <). For example:

cat urls.txt | lil-scraper  --pattern '< last-modified: (.+)'

Command-line options

-p, --pattern (required)

A Rust regular expression with a capture group which will be used to search and extract text from the HTTP responses.

-t, --timeout (defaults to 5 seconds)

The amount of time to wait for an HTTP response before disconnecting.

Test

Run the test suite with:

cargo test

License

Distributed under the MIT License. See LICENSE for more information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.