Supported Python versions¶
Scrapy requires Python 3.6+, either the CPython implementation (default) orthe PyPy 7.2.0+ implementation (see Alternate Implementations).
Web Scraper utilizes a modular structure that is made of selectors, which instructs the scraper on how to traverse the target site and what data to extract. Thanks to this structure, Web Scraper is able to extract information from modern and dynamic websites such as Amazon, Tripadvisor, eBay, and so on, as well as from smaller, lesser-known. A versatile Ruby web spidering library that can spider a site, multiple domains, certain links or infinitely. Spidr is designed to be fast and easy to use. Ruby crawler scraper web spider web-crawler web-scraper web-scraping web-spider spider-links Updated on Mar 1. Scraper API is a web scraping API that handles proxy rotation, browsers, and CAPTCHAs so developers can scrape any page with a single API call. Get started with 1000 free API calls!
If you’re using Anaconda or Miniconda, you can install the package fromthe conda-forge channel, which has up-to-date packages for Linux, Windowsand macOS.
To install Scrapy using
Alternatively, if you’re already familiar with installation of Python packages,you can install Scrapy and its dependencies from PyPI with:
We strongly recommend that you install Scrapy in ,to avoid conflicting with your system packages.
Note that sometimes this may require solving compilation issues for some Scrapydependencies depending on your operating system, so be sure to check the.
For more detailed and platform specifics instructions, as well astroubleshooting information, read on.
Things that are good to know¶
Scrapy is written in pure Python and depends on a few key Python packages (among others):
lxml, an efficient XML and HTML parser
parsel, an HTML/XML data extraction library written on top of lxml,
w3lib, a multi-purpose helper for dealing with URLs and web page encodings
twisted, an asynchronous networking framework
cryptography and pyOpenSSL, to deal with various network-level security needs
The minimal versions which Scrapy is tested against are:
Scrapy may work with older versions of these packagesbut it is not guaranteed it will continue workingbecause it’s not being tested against them.
Some of these packages themselves depends on non-Python packagesthat might require additional installation steps depending on your platform.Please check .
In case of any trouble related to these dependencies,please refer to their respective installation instructions:
Best Free Web Scraper
Using a virtual environment (recommended)¶
TL;DR: We recommend installing Scrapy inside a virtual environmenton all platforms.
Python packages can be installed either globally (a.k.a system wide),or in user-space. We do not recommend installing Scrapy system wide.
Instead, we recommend that you install Scrapy within a so-called“virtual environment” (
venv).Virtual environments allow you to not conflict with already-installed Pythonsystem packages (which could break some of your system tools and scripts),and still install packages normally with
sudo and the likes).
See Virtual Environments and Packages on how to create your virtual environment.
Once you have created a virtual environment, you can install Scrapy inside it with
pip,just like any other Python package.(See below for non-Python dependencies that you may need to install beforehand).
Platform specific installation notes¶
Though it’s possible to install Scrapy on Windows using pip, we recommend youto install Anaconda or Miniconda and use the package from theconda-forge channel, which will avoid most installation issues.
Once you’ve installed Anaconda or Miniconda, install Scrapy with:
To install Scrapy on Windows using
This installation method requires “Microsoft Visual C++” for installing someScrapy dependencies, which demands significantly more disk space than Anaconda.
Download and execute Microsoft C++ Build Tools to install the Visual Studio Installer.
Run the Visual Studio Installer.
Under the Workloads section, select C++ build tools.
Check the installation details and make sure following packages are selected as optional components:
MSVC (e.g MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.23) )
Windows SDK (e.g Windows 10 SDK (10.0.18362.0))
Install the Visual Studio Build Tools.
Now, you should be able to using
Ubuntu 14.04 or above¶
Scrapy is currently tested with recent-enough versions of lxml,twisted and pyOpenSSL, and is compatible with recent Ubuntu distributions.But it should support older versions of Ubuntu too, like Ubuntu 14.04,albeit with potential issues with TLS connections.
Don’t use the
python-scrapy package provided by Ubuntu, they aretypically too old and slow to catch up with latest Scrapy.
To install Scrapy on Ubuntu (or Ubuntu-based) systems, you need to installthese dependencies:
libxslt1-devare required for
libffi-devare required for
Inside a ,you can install Scrapy with
pip after that:
The same non-Python dependencies can be used to install Scrapy in DebianJessie (8.0) and above.
Building Scrapy’s dependencies requires the presence of a C compiler anddevelopment headers. On macOS this is typically provided by Apple’s Xcodedevelopment tools. To install the Xcode command line tools open a terminalwindow and run:
There’s a known issue thatprevents
pip from updating system packages. This has to be addressed tosuccessfully install Scrapy and its dependencies. Here are some proposedsolutions:
(Recommended)Don’t use system python, install a new, updated versionthat doesn’t conflict with the rest of your system. Here’s how to do it usingthe homebrew package manager:
Install homebrew following the instructions in https://brew.sh/
PATHvariable to state that homebrew packages should beused before system packages (Change
.zshrcaccordantlyif you’re using zsh as default shell):
.bashrcto ensure the changes have taken place:
Latest versions of python have
pipbundled with them so you won’t needto install it separately. If this is not the case, upgrade python:
This method is a workaround for the above macOS issue, but it’s an overallgood practice for managing dependencies and can complement the first method.
After any of these workarounds you should be able to install Scrapy:
We recommend using the latest PyPy version. The version tested is 5.9.0.For PyPy3, only Linux installation was tested.
Most Scrapy dependencies now have binary wheels for CPython, but not for PyPy.This means that these dependencies will be built during installation.On macOS, you are likely to face an issue with building Cryptography dependency,solution to this problem is describedhere,that is to
brewinstallopenssl and then export the flags that this commandrecommends (only needed when installing Scrapy). Installing on Linux has no specialissues besides installing build dependencies.Installing Scrapy with PyPy on Windows is not tested.
You can check that Scrapy is installed correctly by running
scrapybench.If this command gives errors such as
TypeError:...got2unexpectedkeywordarguments, this meansthat setuptools was unable to pick up one PyPy-specific dependency.To fix this issue, run
AttributeError: ‘module’ object has no attribute ‘OP_NO_TLSv1_1’¶
After you install or upgrade Scrapy, Twisted or pyOpenSSL, you may get anexception with the following traceback:
The reason you get this exception is that your system or virtual environmenthas a version of pyOpenSSL that your version of Twisted does not support.
To install a version of pyOpenSSL that your version of Twisted supports,reinstall Twisted with the
tls extra option:
For details, see Issue #2473.
- Why lxml?
- Installing lxml
- Benchmarks and Speed
- lxml FAQ - Frequently Asked Questions
- Developing with lxml
- The lxml.etree Tutorial
- APIs specific to lxml.etree
- Parsing XML and HTML with lxml
- Validation with lxml
- XPath and XSLT with lxml
- BeautifulSoup Parser
- html5lib Parser
- Extending lxml
- Document loading and URL resolving
- Python extensions for XPath and XSLT
- Using custom Element classes in lxml
- Sax support
- The public C-API of lxml.etree
- Developing lxml
- How to build lxml from source
- How to read the source of lxml
lxml is the most feature-richand easy-to-use libraryfor processing XML and HTMLin the Python language.
The lxml XML toolkit is a Pythonic binding for the C librarieslibxml2 and libxslt. It is unique in that it combines the speed andXML feature completeness of these libraries with the simplicity of anative Python API, mostly compatible but superior to the well-knownElementTree API. The latest release works with all CPython versionsfrom 2.7 to 3.9. See the introduction for more information aboutbackground and goals of the lxml project. Some common questions areanswered in the FAQ.
lxml has been downloaded from the Python Package Indexmillions of times and is also available directly in many packagedistributions, e.g. for Linux or macOS.
Most people who use lxml do so because they like using it.You can show us that you like it by blogging about your experiencewith it and linking to the project website.
If you are using lxml for your work and feel like giving a bit ofyour own benefit back to support the project, consider sending usmoney through GitHub Sponsors, Tidelift or PayPal that we can useto buy us free time for the maintenance of this great library, tofix bugs in the software, review and integrate code contributions,to improve its features and documentation, or to just take a deepbreath and have a cup of tea every once in a while.Please read the Legal Notice below, at the bottom of this page.Thank you for your support.
Support lxml through GitHub Sponsors
via a Tidelift subscription
or via PayPal:
Please contact Stefan Behnelfor other ways to support the lxml project,as well as commercial consulting, customisations and trainings on lxml andfast Python XML processing.
Travis-CI and AppVeyorsupport the lxml project with their build and CI servers.Jetbrains supports the lxml project by donating free licenses of theirPyCharm IDE.Another supporter of the lxml project isCOLOGNE Webdesign.
The complete lxml documentation is available for download as PDFdocumentation. The HTML documentation from this web site is part ofthe normal source download.
- the lxml.etree tutorial for XML processing
- John Shipman's tutorial on Python XML processing with lxml
- Fredrik Lundh's tutorial for ElementTree
- compatibility and differences of lxml.etree
- ElementTree performance characteristics and comparison
- lxml.etree specific API documentation
- the generated API documentation as a reference
- parsing and validating XML
- XPath and XSLT support
- Python XPath extension functions for XPath and XSLT
- custom XML element classes for custom XML APIs (see EuroPython 2008 talk)
- a SAX compliant API for interfacing with other XML tools
- a C-level API for interfacing with external C/Cython modules
- lxml.objectify API documentation
- a brief comparison of objectify and etree
lxml.etree follows the ElementTree API as much as possible, buildingit on top of the native libxml2 tree. If you are new to ElementTree,start with the lxml.etree tutorial for XML processing. See also theElementTree compatibility overview and the ElementTree performancepage comparing lxml to the original ElementTree and cElementTreeimplementations.
Right after the lxml.etree tutorial for XML processing and theElementTree documentation, the next place to look is the lxml.etreespecific API documentation. It describes how lxml extends theElementTree API to expose libxml2 and libxslt specific XMLfunctionality, such as XPath, Relax NG, XML Schema, XSLT, andc14n (including c14n 2.0).Python code can be called from XPath expressions and XSLTstylesheets through the use of XPath extension functions. lxmlalso offers a SAX compliant API, that works with the SAX support inthe standard library.
Github Web Scraper
There is a separate module lxml.objectify that implements a data-bindingAPI on top of lxml.etree. See the objectify and etree FAQ entry for acomparison.
In addition to the ElementTree API, lxml also features a sophisticatedAPI for custom XML element classes. This is a simple way to writearbitrary XML driven APIs on top of lxml. lxml.etree also has aC-level API that can be used to efficiently extend lxml.etree inexternal C modules, including fast custom element class support.
Github Simple Web Scraper
The best way to download lxml is to visit lxml at the Python PackageIndex (PyPI). It has the sourcethat compiles on various platforms. The source distribution is signedwith this key.
The latest version is lxml 4.6.3, released 2021-03-21(changes for 4.6.3). Older versionsare listed below.
Please take a look at theinstallation instructions !
This complete web site (including the generated API documentation) ispart of the source distribution, so if you want to download thedocumentation for offline use, take the source archive and copy thedoc/html directory out of the source tree, or use thePDF documentation.
The latest installable developer sourcesare available from Github. It's also possible to check outthe latest development version of lxml from Github directly, using a commandlike this (assuming you use hg and have hg-git installed):
Alternatively, if you use git, this should work as well:
You can browse the source repository and its history throughthe web. Please read how to build lxml from sourcefirst. The latest CHANGES of the developer version are alsoaccessible. You can check there if a bug you found has been fixedor a feature you want has been implemented in the latest trunk version.
Questions? Suggestions? Code to contribute? We have a mailing list.
You can search the archive with Gmane or Google.
lxml uses the launchpad bug tracker. If you are sure you found abug in lxml, please file a bug report there. If you are not surewhether some unexpected behaviour of lxml is a bug or not, pleasecheck the documentation and ask on the mailing list first. Do notforget to search the archive (e.g. with Gmane)!
The lxml library is shipped under a BSD license. libxml2 and libxslt2itself are shipped under the MIT license. There should therefore be noobstacle to using lxml in your codebase.
See the websites of lxml4.5,4.4,4.3,4.2,4.1,4.0,3.8,3.7,3.6,3.5,3.4,3.3,3.2,3.1,3.0,2.3,2.2,2.1,2.0,1.3
- lxml 4.6.3, released 2021-03-21 (changes for 4.6.3)
- lxml 4.6.2, released 2020-11-26 (changes for 4.6.2)
- lxml 4.6.1, released 2020-10-18 (changes for 4.6.1)
- lxml 4.6.0, released 2020-10-17 (changes for 4.6.0)
- lxml 4.5.2, released 2020-07-09 (changes for 4.5.2)
- lxml 4.5.1, released 2020-05-19 (changes for 4.5.1)
- lxml 4.5.0, released 2020-01-29 (changes for 4.5.0)
- lxml 4.4.3, released 2020-01-28 (changes for 4.4.3)
- lxml 4.4.2, released 2019-11-25 (changes for 4.4.2)
- lxml 4.4.1, released 2019-08-11 (changes for 4.4.1)
- lxml 4.4.0, released 2019-07-27 (changes for 4.4.0)
- Total project income in 2019: EUR 717.52 (59.79 € / month)
- Tidelift: EUR 360.30
- Paypal: EUR 157.22
- other: EUR 200.00
Python Scraper Github
Any donation that you make to the lxml project is voluntary andis not a fee for any services, goods, or advantages. By makinga donation to the lxml project, you acknowledge that we have theright to use the money you donate in any lawful way and for anylawful purpose we see fit and we are not obligated to disclosethe way and purpose to any party unless required by applicablelaw. Although lxml is free software, to the best of our knowledgethe lxml project does not have any tax exempt status. The lxmlproject is neither a registered non-profit corporation nor aregistered charity in any country. Your donation may or may notbe tax-deductible; please consult your tax advisor in this matter.We will not publish or disclose your name and/or e-mail addresswithout your consent, unless required by applicable law. Yourdonation is non-refundable.