CodeRigor

FREE COURSE / REAL PRACTICE

HTML, URLs & parsing

Parse local HTML, resolve and classify URL references, and produce deterministic link reports in Python.

Free lessons & exercises7 authored lessons3 units

What you’ll work toward

Build a tested local-site link audit with explicit parsing, URL identity, escaping and snapshot limitations.

Read an explanation, inspect the diagrams and work through the available checks, debugging exercises and builds. Feedback and prerequisite links guide the next step.

Before you start

This course builds on these skills:

Individual lessons can add prerequisites. The course map shows your actual readiness.

A look inside the first lesson

HTML documents, elements & parser events

Python
from html.parser import HTMLParser

class Trace(HTMLParser):
    def handle_starttag(self, tag, attrs):
        print("start", tag)
    def handle_data(self, data):
        print("data", repr(data))

parser = Trace(convert_charrefs=True)
parser.feed('<P>Fish &amp; chips<br></P>')
parser.close()

Your course outline

Follow the lessons in curriculum order. Open a unit to preview the ideas you’ll work with.

UNIT 013 lessons HTML structure and URL references
  1. LESSON 01.01

    HTML documents, elements & parser events

    Separate HTML source, the document tree and streaming parser events while counting elements and retaining decoded text.

    Open lesson
  2. LESSON 01.02

    Extract anchors with structured HTML parsing

    Collect href values and nested anchor text with explicit state, missing-value rules and whitespace policy.

    Open lesson
  3. LESSON 01.03

    Resolve references against document bases

    Resolve relative, root-relative, query-only and network-path references without confusing joining with validation or fetching.

    Open lesson
UNIT 023 lessons Identity, reports and link inventories
  1. LESSON 02.01

    Choose document identity and query policies

    Normalize a documented HTTP(S) subset, retain meaningful path/query differences and inspect form-style query pairs without data loss.

    Open lesson
  2. LESSON 02.02

    Escape data and serialize deterministic reports

    Render inert HTML report data with context-appropriate escaping and produce reproducible JSON without mutating inputs.

    Open lesson
  3. LESSON 02.03

    Group a page’s links into an inventory

    Compose anchor extraction, base resolution and document identity into deterministic same-origin and external link counts.

    Open lesson
UNIT 031 lesson Local-site audit capstone
  1. LESSON 03.01

    Capstone: audit a local site’s link graph

    Analyze supplied local HTML pages, resolve declared bases, find missing targets and unreachable pages, and serialize an honest audit.

    Open lesson