# How to Verify If a Course Link Is Still Active

> Learn how to verify if a course link is still active using HTTP HEAD or GET requests. Discover the method to check link validity in the cs-video-courses repository.

- Repository: [Developer-Y/cs-video-courses](https://github.com/Developer-Y/cs-video-courses)
- Tags: how-to-guide
- Published: 2026-03-02

---

**You can verify if a course link is still active by issuing HTTP HEAD or GET requests to the URL and checking for 2xx or 3xx status codes, since the cs-video-courses repository contains only static Markdown links without built-in validation.**

The **cs-video-courses** repository by Developer-Y is a curated list of free computer science video courses hosted externally. Because the project stores only Markdown links in [`README.md`](https://github.com/Developer-Y/cs-video-courses/blob/main/README.md) without any backend services or automated scripts, link rot detection requires external validation tools. This guide provides concrete Python implementations to probe URLs and confirm they remain reachable.

## Understanding the Repository Structure

The **cs-video-courses** repository has a minimal architecture consisting solely of documentation files. There is no executable code, API, or continuous integration pipeline performing health checks on the hundreds of listed URLs.

- **[`README.md`](https://github.com/Developer-Y/cs-video-courses/blob/main/README.md)** contains the entire catalogue as plain Markdown links (e.g., lines 71-78 reference the CS 10 Berkeley course). Each entry is a standard Markdown hyperlink pointing to publicly hosted video resources.
- **[`NOTES.md`](https://github.com/Developer-Y/cs-video-courses/blob/main/NOTES.md)** provides contributor guidelines but contains no link data.
- **[`CONTRIBUTING.md`](https://github.com/Developer-Y/cs-video-courses/blob/main/CONTRIBUTING.md)** recommends verifying URLs before submitting updates, yet offers no automated tooling.

Because the repository delegates hosting to external universities and platforms like YouTube, verification must happen client-side through direct HTTP probing.

## HTTP Verification Strategy

To verify if a course link is still active without downloading multi-gigabyte video files, use lightweight HTTP requests that inspect server headers rather than content payloads.

### Why HEAD Requests Are Preferred

A **HEAD** request asks the server for status codes and metadata without transferring the response body. This is ideal for checking large video resources because:

1. **Bandwidth efficiency** – No video data downloads; only headers transfer.
2. **Speed** – Servers respond faster when omitting body content.
3. **Accuracy** – Status codes 200, 301, or 302 confirm the resource exists or has moved permanently.

### Handling Redirects and Edge Cases

Some educational platforms block HEAD requests while permitting GET requests. When a HEAD request returns **4xx** or **5xx**, fall back to a **GET** request with `stream=True` to limit byte retrieval. Always enable `allow_redirects=True` to follow 3xx redirects to their final destinations, as many university course pages redirect to current semester URLs.

## Practical Implementation

The following Python scripts use the **`requests`** library to automate link verification against the catalogue.

### Single Link Verification Script

Use this function to test individual URLs from [`README.md`](https://github.com/Developer-Y/cs-video-courses/blob/main/README.md):

```python
import requests

def is_link_active(url: str) -> bool:
    """Return True if the URL responds with HTTP 2xx/3xx, otherwise False."""
    try:
        # Prefer HEAD; fall back to GET if the server rejects HEAD.

        resp = requests.head(url, allow_redirects=True, timeout=5)
        if resp.status_code >= 400:
            # Some servers reject HEAD – try a lightweight GET.

            resp = requests.get(url, stream=True, allow_redirects=True, timeout=5)
        return resp.status_code < 400
    except requests.RequestException:
        return False

# Example: verify the CS 10 course link from README.md line 71

link = "http://www.infocobuild.com/education/audio-video-courses/computer-science/cs10-spring2015-berkeley.html"
print(is_link_active(link))   # → True if still reachable

```

### Batch Validation for the Full Catalogue

To audit every link in the repository locally, extract URLs using regular expressions and validate them in a loop:

```python
import re
import requests
import pathlib

README = pathlib.Path("README.md")
URL_PATTERN = re.compile(r"https?://[^\s)]+")   # matches any URL in the file

def check_all_links():
    results = {}
    for line in README.read_text(encoding="utf-8").splitlines():
        for url in URL_PATTERN.findall(line):
            results[url] = is_link_active(url)
    return results

if __name__ == "__main__":
    status = check_all_links()
    for url, ok in status.items():
        print(f"{url} → {'OK' if ok else 'BROKEN'}")

```

Run this script against a local clone of **Developer-Y/cs-video-courses** to generate a complete health report.

## Summary

- The **cs-video-courses** repository stores only static Markdown in [`README.md`](https://github.com/Developer-Y/cs-video-courses/blob/main/README.md) with no built-in link validation.
- **HEAD** requests provide the fastest method to verify if a course link is still active, with **GET** requests serving as a fallback.
- Valid links return **2xx** (success) or **3xx** (redirect) status codes; **4xx** and **5xx** indicate dead or failing resources.
- Automate verification using Python's `requests` library to parse [`README.md`](https://github.com/Developer-Y/cs-video-courses/blob/main/README.md) and probe URLs in batches.

## Frequently Asked Questions

### Does the cs-video-courses repository automatically check for broken links?

No. According to the source code analysis, the repository contains no scripts, GitHub Actions, or backend services. The [`README.md`](https://github.com/Developer-Y/cs-video-courses/blob/main/README.md) file holds only static Markdown links, making manual or client-side script verification necessary to detect dead links.

### What HTTP status code indicates a course link is still active?

Status codes in the **2xx** range (particularly 200 OK) confirm an active link. **3xx** codes (301, 302) also indicate active resources that have moved, provided your HTTP client follows redirects. Any **4xx** client error or **5xx** server error signals a broken or unreachable link.

### How do I check all links in the README.md at once?

Clone the repository and run the batch validation Python script provided above. This script uses the regular expression pattern `r"https?://[^\s)+]"` to extract every URL from [`README.md`](https://github.com/Developer-Y/cs-video-courses/blob/main/README.md), then iterates through them calling `is_link_active()` to test reachability.

### Why do some valid links return 4xx errors when checked?

Some educational servers reject **HEAD** requests for security or configuration reasons, returning 405 Method Not Allowed or similar errors. When this occurs, fall back to a **GET** request with `stream=True` to verify the link without downloading the full content. Additionally, aggressive rate-limiting by hosts may temporarily return 403 or 429 status codes.