Phpbb2Crawler (Phpbb2 Crawler v0.1.0)

Copy Markdown View Source

A production-grade recursive web crawler and scraper for legacy phpBB2 forums supporting both public (anonymous) and authenticated scraping built with Elixir, Finch, and Floki.

It automatically walks the board hierarchy—from index categories to individual forums, paginated topic threads, posts, and user profiles—utilizing concurrent streams and built-in rate limiting to safely migrate data without overwhelming legacy server infrastructure.

Examples

# 1. Initialize an anonymous (public) scraper session
crawler = Phpbb2Crawler.new("http://legacy-forum.local/phpBB2")

# 2. Alternatively, authenticate to access protected boards
{:ok, crawler} = Phpbb2Crawler.login("http://legacy-forum.local/phpBB2", "admin", "secret_pass")

# 3. Execute the full recursive crawl
scraped_data = Phpbb2Crawler.crawl_all(crawler)

IO.inspect(length(scraped_data.forums), label: "Total Forums")
IO.inspect(length(scraped_data.topics), label: "Total Topics")
IO.inspect(length(scraped_data.posts), label: "Total Posts")

Summary

Functions

Starts a full crawl (works whether the struct has a cookie or is nil).

Logs into the phpBB2 forum and returns an authenticated crawler struct.

Initializes a public (unauthenticated) crawler session.

Lazily streams topics across all pages of a forum.

Lazily streams posts across all pages of a topic.

Functions

crawl_all(crawler, concurrency \\ 4, timeout \\ 15000)

Starts a full crawl (works whether the struct has a cookie or is nil).

fetch_forums(crawler)

login(base_url, username, password, opts \\ [])

Logs into the phpBB2 forum and returns an authenticated crawler struct.

new(base_url, opts \\ [])

Initializes a public (unauthenticated) crawler session.

stream_forum_topics(crawler, forum_id, concurrency \\ 4, timeout \\ 15000)

Lazily streams topics across all pages of a forum.

stream_topic_posts(crawler, topic_id, concurrency \\ 4, timeout \\ 15000)

Lazily streams posts across all pages of a topic.