title: How do I scrape selected list-items from a webpage?
body: <p>I'm trying to scrape Marvel movies with their characters (featured, support, antagonists, other) on <a href="http://marvel.wikia.com/wiki/Marvel_films" rel="nofollow noreferrer">marvel.wikia.com</a>. Now these characters live in lists in the DOM and I can't get the right <code>html_nodes()</code> to get all the list items underneath each character type.  </p>
  
  <p>The following code extracts all the listed links, while I want only the ones belonging to the featured- support- antagonists- and othercharacters (not applicable for X2).</p>
  
  <pre><code>library(rvest)
  library(tidyverse)
  
  test_url &lt;- "http://marvel.wikia.com/wiki/X2_(film)"
  
  read_html(test_url) %&gt;%
    html_nodes("li &gt; a") %&gt;%
    html_text() 
  </code></pre>
  
  <p>Desired outcome:</p>
  
  <pre><code># A tibble: 16 x 3
     movie type                  character                  
     &lt;chr&gt; &lt;chr&gt;                 &lt;chr&gt;                      
   1 X2    Featured Characters   Professor Charles Xavier   
   2 X2    Featured Characters   Wolverine (Logan)          
   3 X2    Featured Characters   Storm (Ororo Munroe)       
   4 X2    Featured Characters   Dr. Jean Grey              
   5 X2    Featured Characters   Cyclops (Scott Summers)    
   6 X2    Featured Characters   Rogue (Marie)              
   7 X2    Featured Characters   Iceman (Bobby Drake)       
   8 X2    Supporting Characters Nightcrawler (Kurt Wagner) 
   9 X2    Supporting Characters Pyro (John Allerdyce)      
  10 X2    Supporting Characters Mystique (Raven Darkholme) 
  11 X2    Supporting Characters Magneto (Erik Lehnsherr)   
  12 X2    Antagonists           Col. William Stryker       
  13 X2    Antagonists           Sgt. Lyman                 
  14 X2    Antagonists           Unnamed Soldiers           
  15 X2    Antagonists           Deathstrike (Yuriko Oyama) 
  16 X2    Antagonists           Mutant 143 (Jason Stryker)
  </code></pre>