Skip to main content

Google-Image-Scraper

About

This module is based on web-scraping technology and uses Google Images to provide a Streamable Image API.

Supported Browsers

  • Chrome

How to Use?

# import Scraper class
from gi_scraper import Scraper


# Pass a Cache instance with a custom directory path and timeout
# Set cache timeout to -1 for caching indefinitely

"""
from gi_scraper import Cache

cache = Cache(dir_path="gi_cache", timeout=-1)
sc = Scraper(workers=8, headless=False, cache=cache)
"""

# The object creation has an overhead time
# The same object can be reused to fire multiple queries
sc = Scraper(headless=False)

for query, count in {"Naruto": 20, "Gintoki": 30}.items():
    print("Scraping...", query, ":", count)

    # scrape method returns a stream object
    stream = sc.scrape(query, count)

    # stream.get method yields Response object with following attributes
    # - query (str): The query associated with the response.
    # - name (str): The name attribute of the response.
    # - src_name (str): The source name attribute of the response.
    # - src_page (str): The source page attribute of the response.
    # - thumbnail (str): The thumbnail attribute of the response.
    # - image (str): The image attribute of the response.
    # - width (int): The width attribute of the response.
    # - height (int): The height attribute of the response.

    for index, response in enumerate(stream.get()):
        if index == 10:
            sc.terminate_query()  # Terminate current query midway
            break
        # response.to_dict returns python representable dictionary
        print(response.width, "x", response.height, ":", response.image)


# call this to terminate scraping (auto-called by destructor)
sc.terminate()

Metadata

Release files for gi-scraper 0.4.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gi-scraper 0.4.6
File Size Uploaded Provenance Actions
gi_scraper-0.4.6.tar.gz 9.0 kB Without provenance Details for gi_scraper-0.4.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gi-scraper 0.4.6
File Interpreter ABI Platform Actions
gi_scraper-0.4.6-py3-none-any.whl Python 3 none any Details for gi_scraper-0.4.6-py3-none-any.whl

Total release size: 18.9 kB

Release files / gi_scraper-0.4.6.tar.gz

Download URL gi_scraper-0.4.6.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b8351dfe076c1346c66b1d4271fafc4912bc9ff008f9ce190043440b5e3e336f
BLAKE2b-256 checksum
How to use checksums
1d039333737254bda8f9b45a5c405630828cef30288574d07b1ffb539ee1ab48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.19

Release files / gi_scraper-0.4.6-py3-none-any.whl

Download URL gi_scraper-0.4.6-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
67f42deb3b5b4898c2169e11a98416322eaff626b3931432a046aa072d519bba
BLAKE2b-256 checksum
How to use checksums
c862e1928081d14a1b8539ca236c28b5e020f69217656b3e2006346b184b19c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.19

Security for gi-scraper 0.4.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page