Skip to main content

Web Scraping Framework

Project description

Grab

https://travis-ci.org/lorien/grab.png?branch=v06 https://coveralls.io/repos/lorien/grab/badge.svg?branch=v06 https://pypip.in/download/grab/badge.svg?period=month https://pypip.in/version/grab/badge.svg https://landscape.io/github/lorien/grab/v06/landscape.png https://readthedocs.org/projects/grab/badge/?version=latest

What is Grab?

Grab is a python web scraping framework. Grab provides tons of helpful methods to scrape web sites and to process the scraped content:

  • Automatic cookies (session) support

  • HTTP and SOCKS proxy with and without authorization

  • Keep-Alive support

  • IDN support

  • Tools to work with web forms

  • Easy multipart file uploading

  • Flexible customization of HTTP requests

  • Automatic charset detection

  • Powerful API of extracting info from HTML documents with XPATH queries

  • Asynchronous API to make thousands of simultaneous queries. This part of library called Spider and it is too big to even list its features in this README.

  • Python 3 ready

Grab Example

from grab import Grab

g = Grab()
g.go('https://github.com/login')
g.set_input('login', 'lorien')
g.set_input('password', '***')
g.submit()
for elem in g.doc.select('//ul[@id="repo_listing"]/li/a'):
    print('%s: %s' % (elem.text(), elem.attr('href')))

Grab::Spider Example

from grab.spider import Spider, Task
import logging

class ExampleSpider(Spider):
    def task_generator(self):
        for lang in ('python', 'ruby', 'perl'):
            url = 'https://www.google.com/search?q=%s' % lang
            yield Task('search', url=url)

    def task_search(self, grab, task):
        print(grab.doc.select('//div[@class="s"]//cite').text())


logging.basicConfig(level=logging.DEBUG)
bot = ExampleSpider()
bot.run()

Installation

Pip is recommended way to install Grab and its dependencies:

$ pip install -U grab

See details here http://docs.grablib.org/en/latest/usage/installation.html

Documentation and Help

Documentation: http://docs.grablib.org/en/latest/

English mailing list: http://groups.google.com/group/grab-users/

Russian mailing list: http://groups.google.com/group/python-grab/

Contribution

To report a bug please use github issue tracker: https://github.com/lorien/grab/issues

If you want to develop new feature in Grab please use issue tracker to describe what you want to do or contact me at lorien@lorien.name

Project details


Release history Release notifications | RSS feed

This version

0.6.2

Download files

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

Source Distribution

grab-0.6.2.tar.gz (87.1 kB view details)

Uploaded Source

File details

Details for the file grab-0.6.2.tar.gz.

File metadata

  • Download URL: grab-0.6.2.tar.gz
  • Upload date:
  • Size: 87.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for grab-0.6.2.tar.gz
Algorithm Hash digest
SHA256 d7391be052614f333df6ccf6aa512f485a4e6c95bf8c63b12c55ac933aa315b4
MD5 c2d5c565d33722470d30575e2ce0f656
BLAKE2b-256 396d7084aef70d8f75bc76e36b43ee2f4fcf3d63ed5ffcf2912751d50edeb169

See more details on using hashes here.

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