

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 6
click for more info
Not enough gems
Cost: 6 gems
1: Main
incomplete
2: Get HTML
incomplete
3: Adding Recursion
incomplete
This lesson's interactive features are locked, please to keep using them
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.
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.