Skip to main content

ScrapeWebdriver

Class based on selenium webdriver.Firefox with methods for scraping. Allow dynamically change proxies with change of `"about:config".

Changelog presented in CHANGELOG.md.

Installation

pip install scrapy_webdriver

Basic usage

For use selenium, need to yield SeleniumRequest and if you need to make some actions on page, can use driver_func.

from typing import Iterable
import scrapy 
from scrapy.http import Request

from scrapy_webdriver.middleware_utils.drivers import Driver
from scrapy_webdriver.middleware_utils.http import SeleniumRequest


class TestSpider(scrapy.Spider):
    name = "simple_spider"
    start_urls = ["http://example.org"]

    def start_requests(self) -> Iterable[Request]:
        for url in self.start_urls:
            yield SeleniumRequest(
                url=url,
                callback=self.parse,
                driver_func=self.parse_page_with_driver,
            )

    def parse_page_with_driver(self, driver: Driver):
        self.logger.info("Page opened")

    def parse(self, response, **kwargs):
        yield {"title": response.css("title::text").get()}

Available options

  • SELENIUM_POOL_SIZE - how many concurrent browser instances will be opened at same time, default 1
  • SELENIUM_PROXY_POOL - proxy pool in format Iteable[http://user:pass@host:port], default ().
  • SELENIUM_CHANGE_PROXY_ON_EACH_REQUEST - change or not proxy before each request, default True.
  • SELENIUM_INSTALL_ADBLOCK - install adblock extension for block some requests, default True.
  • SELENIUM_RUN_PYVIRTUAL_DISPLAY - run py virtual display for not run drivers in headless on server, default False.
  • SELENIUM_HEADLESS - run headless or not.

Metadata

Release files for scrapy_webdriver 1.0.10

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

Source distribution (sdist)

Source distribution for scrapy_webdriver 1.0.10
File Size Uploaded Provenance Actions
scrapy_webdriver-1.0.10.tar.gz 8.4 MB Without provenance Details for scrapy_webdriver-1.0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for scrapy_webdriver 1.0.10
File Interpreter ABI Platform Actions
scrapy_webdriver-1.0.10-py3-none-any.whl Python 3 none any Details for scrapy_webdriver-1.0.10-py3-none-any.whl

Total release size: 17.3 MB

Release files / scrapy_webdriver-1.0.10.tar.gz

Download URL scrapy_webdriver-1.0.10.tar.gz
Size 8.4 MB
Tags Source
SHA-256 checksum
How to use checksums
e15db7c0b781ec01cba30da822eb6414b0c92964073d08c810040daa258af745
BLAKE2b-256 checksum
How to use checksums
9039fb449ffd250c7ff783d708e0fa02d35c26a184f0f74ab86d04011937e8e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.11 Linux/5.15.0-135-generic

Release files / scrapy_webdriver-1.0.10-py3-none-any.whl

Download URL scrapy_webdriver-1.0.10-py3-none-any.whl
Size 8.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
b35eaf82f79f4c1f64a9659b34879fe2cbe200b0c4e43f98707507d4dce9f0e5
BLAKE2b-256 checksum
How to use checksums
8d972daedf17f050a85dad0f13201dc8a9505f6c1a218d2ce43568e4d5988cf1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.11 Linux/5.15.0-135-generic

Security for scrapy_webdriver 1.0.10

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.

Release history Release notifications | RSS feed

This release

1.0.10 This release

2 release files No provenance

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