git404hub

what is webmagic fr?

code4craft/webmagic — explained in plain English

Analysis updated 2026-06-24

11,681JavaAudience · developerComplexity · 2/5LicenseSetup · easy

tl;dr

WebMagic is a Java library for building web crawlers that handles page fetching, link following, multi-threading, and data extraction so you only write the rules for what to collect.

vibe map

mindmap
  root((WebMagic))
    What it does
      Web crawling
      Page fetching
      Data extraction
    Extraction methods
      XPath selectors
      CSS selectors
      Regex patterns
    Setup
      Maven dependency
      Java project
      No extra infra
    Audience
      Java developers
      Data collectors
      Web scrapers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

what do people make with this?

VIBE 1

Scrape product listings or article content from a website into a structured Java object using annotation-based field extraction.

VIBE 2

Build a multi-threaded crawler that follows pagination links across many pages and stores results automatically.

VIBE 3

Extract specific HTML elements from pages using XPath or CSS selectors without writing custom HTML-parsing code.

what's the stack?

JavaMavenXPathCSS selectors

how it stacks up fr

code4craft/webmagicfrank-lam/fullstack-tutorialstarrocks/starrocks
Stars11,68111,68911,666
LanguageJavaJavaJava
Setup difficultyeasyeasyhard
Complexity2/51/55/5
Audiencedeveloperdeveloperdata

Figures from each repo's GitHub metadata at analysis time.

how do i run it?

Difficulty · easy time til it works · 30min

Add via Maven, no external infrastructure needed. A basic crawler works with just a few lines of Java.

Use freely for any purpose, including commercial use, with attribution (Apache 2.0).

in plain english

WebMagic is a Java library for building web crawlers. A web crawler is a program that automatically visits web pages and collects information from them. WebMagic is designed to make writing a crawler in Java straightforward, handling the repetitive parts of the job so developers can focus on what data they want to extract. The framework covers the full cycle of crawling: it fetches web pages, manages which URLs to visit next, extracts specific pieces of content from each page, and saves the results somewhere. It runs multiple threads at once so it can process many pages in parallel without requiring the developer to manage that complexity manually. Developers interact with WebMagic in two main ways. The first is by writing a class that implements a provided interface, where you specify what links to follow and what data to pull from each page. The second is an annotation-based approach where you define a plain Java object and mark its fields with labels that describe how to extract each value from the page's HTML. Both styles are shown in the README with example code that crawls GitHub repository pages. The extraction tools in WebMagic support XPath selectors (a standard way to pick specific elements from HTML), regular expressions, and CSS selectors. The library was influenced by a Python crawling framework called Scrapy, which inspired its overall architecture. WebMagic is intended to be easy to integrate into existing Java projects. It is added as a dependency through Maven, the standard Java build tool. The project is licensed under the Apache 2.0 license, which allows free use in both personal and commercial projects. Documentation and additional examples are available on the project's website.

prompts (copy fr)

prompt 1
Show me a complete WebMagic Spider that visits GitHub repository pages and extracts the repo name, star count, and description using the annotation-based model.
prompt 2
Write a WebMagic Spider that crawls all pages of a blog starting from the homepage, extracts article titles and publish dates, and prints them to the console.
prompt 3
How do I configure WebMagic to use 5 download threads and add a 1-second delay between requests to avoid getting blocked?
prompt 4
Show me how to add WebMagic to a Maven project and write the minimal Spider to scrape a single page and extract a value by XPath selector.

Frequently asked questions

what is webmagic fr?

WebMagic is a Java library for building web crawlers that handles page fetching, link following, multi-threading, and data extraction so you only write the rules for what to collect.

What language is webmagic written in?

Mainly Java. The stack also includes Java, Maven, XPath.

What license does webmagic use?

Use freely for any purpose, including commercial use, with attribution (Apache 2.0).

How hard is webmagic to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is webmagic for?

Mainly developer.

peek the repo → explain another one

This repo across BitVibe Labs

double-check against the repo, no cap.