Building a Basic Web Scraper with Python

A web scraper automates the extraction of data from websites. The core process involves two primary steps: fetching web content and parsing the desired information. To begin, install the requests library, which handles HTTP requests. pip install requests Many websites restrict automated access. To mimic a real browser, you need to set a User-A ...

Posted on Tue, 19 May 2026 09:30:13 +0000 by lorenzo-s

Introduction to the Scrapy Framework for Web Scraping

This article explores the fundamentals of web scraping using Python, covering aspects from basic browser automation to the powerful Scrapy framework. Web Scraping with Selenium Selenium is a popular tool for browser automation, enabling the simulation of user interactions with web pages. The following example demonstrates how to use Selenium wi ...

Posted on Sun, 17 May 2026 23:33:31 +0000 by strago

DrissionPage: Unifying Browser Automation and HTTP Requests in Python

Web automation is frequently used to monitor e-commerce prices. The following script demonstrates how to track a product price and trigger an API notification when a target threshold is met. This example utilizes the mixed mode to handle navigation and data extraction seamlessly. from DrissionPage import WebPage import requests import time # I ...

Posted on Sun, 17 May 2026 13:29:16 +0000 by Dodon

Web Scraping and Visualization Techniques for Location Data

Pandas can be used to load and filter Excel datasets containing geographic coordinates. For example, to extract Starbucks store locations in Shanghai from a spreadsheet, read the file and apply a city-based filter. import pandas as pd data_frame = pd.read_excel("stores_data.xlsx") shanghai_locations = data_frame[data_frame['city'] == ...

Posted on Sun, 17 May 2026 08:54:17 +0000 by rckehoe

Extracting Web Table Data and Exporting to Excel Using a Tampermonkey Script

Often we need to download tabular data displayed on a web page as an Excel file. When the site does not provide a suitable download option, a custom script can be used to gather the data and export it. Using a Tampermonkey (userscript) makes it easy to share the solution with others. Below are two practical approaches: one that simulates manual ...

Posted on Sun, 17 May 2026 06:41:49 +0000 by WendyB

Building Distributed Scrapy Spiders with Redis

RedisSpider Overview RedisSpider extends Scrapy's base Spider class to enable distributed crawling. Instead of using a static start_urls list, this spider reads URLs from a Redis queue. Key Differences from Standard Spider The main modifications involve imports, inheritance, and replacing the static URL list with a Redis key: from scrapy_redis. ...

Posted on Sun, 17 May 2026 03:26:31 +0000 by glassroof

C# HTTP Helper for Web Scraping with Automatic Encoding Detection and Cookie Support

This utility class simplifies making HTTP requests in C# while automatically handling character encoding, gzip-compressed responses, cookies, and common request headers. It is especially useful for web scraping scenarios where the target page's encoding is unknown or inconsistent. Core Features Automatic detection of page encoding from HTML me ...

Posted on Fri, 15 May 2026 16:37:01 +0000 by RDKL PerFecT

Scraping Douban Book Data with Scrapy

Scrapy is an asynchronous web crawling framework built on Twisted, enabling efficient and scalable data extraction in Python. To begin scraping book information from Douban’s web site, first install Scrapy using pip: pip install Scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple Create a new project named douban: scrapy startproject douban cd ...

Posted on Fri, 15 May 2026 10:30:34 +0000 by webmaster1

Parsing HTML and XML Data in Python with re, BeautifulSoup, and lxml

Regular Expressions with the re Module The re module provides pattern matching operations for string processing, often used for data etxraction and validation. import re # Extract all numeric sequences from a string number_list = re.findall(r'\d+', 'ID: 12345, Code: 67890') print(number_list) # Use an iterator for memory-efficient matching nu ...

Posted on Thu, 14 May 2026 21:47:22 +0000 by jjfletch

Extracting Audio Files with Python Web Scraping

To extract audio files from websites, Python's requests library can be used to send HTTP requests and retrieve data. The process involves identifying audio URLs from network requests and saving the files locally. First, inspect the network activity of a target webpage using browser developer tools. For example, on a music site like gequbao.com, ...

Posted on Thu, 14 May 2026 15:19:10 +0000 by uatec