Skip to main content

Globy Webcrawlers

Project description

Globy webcrawlers

:star: Scrape the world with Globy! :star:

Usage

$ globy-scraper.py -h
usage: globy-scraper.py [-h] -f URLS_FILE [-l LOGLEVEL] [-o OUTPUT_FILE] [-d] [-s] [-b BACKEND]

options:
  -h, --help            show this help message and exit
  -f URLS_FILE, --urls_file URLS_FILE
                        Newline separated file of URLs to scrape
  -l LOGLEVEL, --loglevel LOGLEVEL
                        Set log level (1-3)
  -o OUTPUT_FILE, --output_file OUTPUT_FILE
                        Output CSV file path
  -d, --debug           Debug/inspect responses (Will set PYTHONINSPECT to True)
  -s, --store_html_to_file
                        Store HTML all content to file per domain in the "html_output" folder
  -b BACKEND, --backend BACKEND
      Select backend to use for scraping: "globy" (default) or "scrapy". 
      (!) The scrapy backend will only dump data to the "html_output" folder for now. No website analysis or other functionallity is supported yet.

Quickstart

You can just run globy-scraper as a script (no installation needed):

pip3 install -r requirements.txt  # Install dependencies if not already installed
./globy-scraper.py -f wordpress-top50.txt

Install the globy-webcrawlers package

You can install the package for development and use with other Globy projects. It's recommended to set up a python virtual environment before installing the package.

pip3 install -e .

Now you can use the package in python:

from globy_webcrawlers.crawler import WebSiteDataCrawler
>>> c = WebSiteDataCrawler()
>>> c.load_urls_from_file("urls.txt")
>>> c.run()

Also, after installing globy-scraper, you can just run it: globy-scraper.py -h

Debugging/inspecting website content

Since the crawler is asynchronous, it can be a bit tricky to debug the responses. To make it easier, you can use the -d flag. This will allow you to inspect the HTML content and any internal objects from the most recent website. Here's an example:

$ ./globy-scraper.py -f wordpress-top50.txt -d
>>> w = crawler.debug_latest_response()
>>> w.url
'https://www.thyroid.org/'
>>> len(w.html_content)
249167
>>> w.get_website_info()

Change the crawler.urls to get the response you want to debug, or the input url list.

Development only

Build and & create python package:

python3 -m build

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

globy-webcrawlers-0.0.1.tar.gz (1.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

globy_webcrawlers-0.0.1-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file globy-webcrawlers-0.0.1.tar.gz.

File metadata

  • Download URL: globy-webcrawlers-0.0.1.tar.gz
  • Upload date:
  • Size: 1.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for globy-webcrawlers-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a0af93aa06e2d0aa9f62a8989b67dfd73f4457618c0a65a458e0bbc8d9074905
MD5 c7b2ef2311088aad95e74decb6016946
BLAKE2b-256 75dc56532aa4189237b6f531c7dbfbf3a5930a09a5f0d896917a312054fc5f30

See more details on using hashes here.

File details

Details for the file globy_webcrawlers-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for globy_webcrawlers-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 63747db2e49f2c69cf58f40a2b742a979e9a0d2a4bd40a2d5f116d8907ee4ba1
MD5 d3c8353931f40eb9c63f1115995b6381
BLAKE2b-256 8858a997954c2d63da1cb049f588bb5480e3107e0e16c31d56599084b95ee04f

See more details on using hashes here.

Supported by

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