Giter Club home page Giter Club logo

webgrep's Introduction

webgrep is a simple tool for scraping websites from the command line

Setup:
> sudo easy_install webgrep 



Example:
Finding number of ratings for a book on goodreads

Find the location of the 'Ratings' in the html by using the -g option:
> webgrep.py -g 'Ratings' -u "http://www.goodreads.com/book/show/4588.Extremely_Loud_and_Incredibly_Close"
match,location
"267,896 Ratings"," 1,3,1,3,5,3,7,1,3,5,14,1,0"

Now use that location value (" 1,3,1,3,5,3,7,1,3,5,14,1,0") as the -l argument to look in the same location on a different page
> webgrep.py -l " 1,3,1,3,5,3,7,1,3,5,14,1,0" -u "http://www.goodreads.com/book/show/1618.The_Curious_Incident_of_the_Dog_in_the_Night_Time"
"778,683 Ratings"





Example:
Using "-" in a location value as a wildcard. Want to find all imdb titles on a page

> webgrep.py  -g Shawshank -u "http://www.imdb.com/search/title?num_votes=50000,&release_date=1990,&sort=user_rating,desc&title_type=feature"
match,location
The Shawshank Redemption," 1,3,3,1,14,12,3,5,3,5,3,0"


> webgrep.py  -g "The Dark Knight" -u "http://www.imdb.com/search/title?num_votes=50000,&release_date=1990,&sort=user_rating,desc&title_type=feature"
match,location
The Dark Knight," 1,3,3,1,14,12,3,5,5,5,3,0"
The Dark Knight Rises," 1,3,3,1,14,12,3,5,69,5,3,0"


> webgrep.py -l " 1,3,3,1,14,12,3,5,-,5,3,0" -u "http://www.imdb.com/search/title?num_votes=50000,&release_date=1990,&sort=user_rating,desc&title_type=feature"
The Shawshank Redemption
The Dark Knight
Schindler's List
Pulp Fiction
The Lord of the Rings: The Return of the King
...






Common errors:
Quote the -u argument in bash or else '&' may be read as running the process in the background instead of part of the url

webgrep's People

Contributors

jasontrigg0 avatar

Stargazers

Thato Motjolopane avatar

Watchers

James Cloos avatar  avatar

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.