We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Get HTML

Let's start crawling real web pages! For these remaining steps, use https://learnwebscraping.dev/practice/ecommerce/. A single product page like https://learnwebscraping.dev/practice/ecommerce/products/ashenfang-longsword-fan-1001/ is a good place to start.

Assignment

func getHTML(rawURL string) (string, error)

For now, your function should:

You may find io.ReadAll helpful in reading the response.

I'd argue that it's not necessary to create unit tests for a function like getHTML. It's primarily just side effects (internet access), making it not a pure function like normalizeURL and getURLsFromHTML. Most of the "logic" in getHTML is just a couple of standard library function calls: and there's not much reason to test the standard library.

Run and submit the CLI tests.

Notice that they're grabbing some HTML from the main page of Wikipedia.