One‑Line Python Web Scraping with Scrapeasy: Quick Start Guide
This article introduces the Scrapeasy Python library, shows how to install it, initialize website and page objects, retrieve links, images, videos, and other file types, and download them with simple one‑line commands, providing a fast way to extract data from any site.
What is Scrapeasy?
Scrapeasy is a Python library that simplifies web scraping, allowing you to fetch data from single pages or entire sites, extract information from PDFs and HTML tables, and download various media types with minimal code.
Key Features
One‑click site scraping, not limited to a single page.
Built‑in support for common media (images, videos, links).
Ability to retrieve special file types such as .php or .pdf.
Installation
$ pip install scrapeasyBasic Usage
Import the main classes and create a Website object with the target URL.
from scrapeasy import Website, Page
web = Website("https://tikocash.com/solange/index.php/2022/04/13/how-do-you-control-irrational-fear-and-overthinking/")Getting Subpage Links
Retrieve all sub‑page URLs of the site.
links = web.getSubpagesLinks()Fetching Images
Collect all image URLs and optionally download them.
images = web.getImages()
web.download("img", "fahrschule/images")Extracting Links
Obtain domain links only:
domains = web.getLinks(intern=False, extern=False, domain=True)Or retrieve all external links without domain filtering:
external_links = web.getLinks(intern=False, extern=True, domain=False)Working with Individual Pages
Create a Page object for a specific URL.
w3 = Page("https://www.w3schools.com/html/html5_video.asp")Downloading Videos
Download all videos from the page to a folder.
w3.download("video", "w3/videos")
video_links = w3.getVideos()Downloading Other File Types
Use the generic .get() method to fetch links of a particular extension, or .download() to save them directly.
calendar_links = Page("https://tikocash.com").get("php")
Page("http://mathcourses.ch/mat182.html").download("pdf", "mathcourses/pdf-files")Conclusion
With just a few lines of Python code, Scrapeasy enables rapid extraction of data, media, and files from any website, making it a powerful tool for web scraping and data mining tasks.
Python Programming Learning Circle
A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
