CommencerCommencer gratuitement

Simply the best!

Given the same HTML as in the previous exercise…

<html>
  <body>
    <div class="first section">
      A text with a <a href="#">link</a>.
    </div>
    <div class="second section">
      Some text with <a href="#">another link</a>.
      <div class="first paragraph">Some text.</div>
      <div class="second paragraph">Some more text.
        <div>...</div>
      </div>
    </div>
  </body>
</html>

…can you find a way to select the same three nodes as before, but with a much simpler selector?

The variable complicated_html has been prepared for you. It contains the HTML document with the above source code.

Cet exercice fait partie du cours

Web Scraping in R

Afficher le cours

Instructions

  • Construct a simple selector that selects all three descendants of div.second.section.
  • This selector should only consist of exactly two div type selectors and a space, encompassing seven characters in total!

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Select the three divs with a simple selector
complicated_html %>%
	html_elements(___)
Modifier et exécuter le code