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.

Download files

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

Source Distribution

scrapy_webdriver-1.0.10.tar.gz (8.4 MB view details)

Uploaded Source

Built Distribution

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

scrapy_webdriver-1.0.10-py3-none-any.whl (8.9 MB view details)

Uploaded Python 3

File details

Details for the file scrapy_webdriver-1.0.10.tar.gz.

File metadata

  • Download URL: scrapy_webdriver-1.0.10.tar.gz
  • Upload date:
  • Size: 8.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.11 Linux/5.15.0-135-generic

File hashes

Hashes for scrapy_webdriver-1.0.10.tar.gz
Algorithm Hash digest
SHA256 e15db7c0b781ec01cba30da822eb6414b0c92964073d08c810040daa258af745
MD5 31e5730d74aabc3709423f2a5528f9c7
BLAKE2b-256 9039fb449ffd250c7ff783d708e0fa02d35c26a184f0f74ab86d04011937e8e0

See more details on using hashes here.

File details

Details for the file scrapy_webdriver-1.0.10-py3-none-any.whl.

File metadata

  • Download URL: scrapy_webdriver-1.0.10-py3-none-any.whl
  • Upload date:
  • Size: 8.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.11 Linux/5.15.0-135-generic

File hashes

Hashes for scrapy_webdriver-1.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 b35eaf82f79f4c1f64a9659b34879fe2cbe200b0c4e43f98707507d4dce9f0e5
MD5 fc022e5e18d043fbaa5a0c75be78ddb9
BLAKE2b-256 8d972daedf17f050a85dad0f13201dc8a9505f6c1a218d2ce43568e4d5988cf1

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.10 This release

2 files

1.0.9

2 files

1.0.8

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0

2 files

0.74

1 file

0.73

1 file

0.71

1 file

0.70

1 file

0.68

1 file

0.67

1 file

0.66

1 file

0.65

1 file

0.64

1 file

0.63

1 file

0.62

1 file

0.61

1 file

0.60

1 file

0.59

1 file

0.58

1 file

0.57

1 file

0.56

1 file

0.55

1 file

0.54

1 file

0.53

1 file

0.52

1 file

0.51

1 file

0.50

1 file

0.49

1 file

0.48

1 file

0.45

1 file

0.44

1 file

0.43

1 file

Supported by

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