Question: I've been trying to learn how to do this and I tried getting the raw source and also as XMLObjects. However, I'm having a difficult time extract the data that I need from a section on the page. I feel that it would be easier if it was a table, but it's a number of lists (HTML "< ul>< li>...< /li >< /ul >") with a header on each (A to Z).

You don't have to give me the solution so much as just guidance. Although I would learn from your code as well.

Here is the page: <https://en.wikipedia.org/wiki/List_of_plants_used_in_herbalism>

I'm hoping to get each list item and the first hyperlink URL in each item.

For "Abscess root" it would return the text and the URL of the first link (<https://en.wikipedia.org/wiki/Polemonium_reptans>). I'm guessing it would be returned as a list [{"Abscess root...", "<http://www>....."}, {...,...}]

Any guidance is appreciated.

Answer: 
You may use the [String Manipulation](http://reference.wolfram.com/language/guide/StringManipulation.html) functions on the `"ArticleWikicode"` property of article using [`WikipediaData`](http://reference.wolfram.com/language/ref/WikipediaData.html).

```
awc = WikipediaData["List of plants used in herbalism", "ArticleWikicode"];

```

Notice that the section you are interested is preceded by `{{Compact ToC}}` and followed by `==Databases==` in wiki code. Use [`StringPosition`](http://reference.wolfram.com/language/ref/StringPosition.html) and [`StringTake`](http://reference.wolfram.com/language/ref/StringTake.html) to get this part of the wiki code.

```
tocDetails = StringTake[awc,
   {1, -1} + 
    MapThread[#1[#2] &, {{Last, First}, 
      StringPosition[awc, {"{{Compact ToC}}", "==Databases=="}]}]];

```

Each item is a bullet with the link immediately following it. In wiki code the link is the article name. Some links have alternatives delimited by a pipe (`|`). Use [`StringCases`](http://reference.wolfram.com/language/ref/StringCases.html) to get the article titles and [`StringSplit`](http://reference.wolfram.com/language/ref/StringSplit.html) to get the first article name when there are alternatives.

```
titles = StringCases[ tocDetails, 
   "\n* [[" ~~ a : Shortest[__] ~~ "]]" :> First@StringSplit[a, "|"], 
   Overlaps -> False];

```

Next notice that Wikipedia article URLs follow a standard pattern with the article title in the URL. The spaces in an article title are replace by an underscore in the URL. Use [`StringTemplate`](http://reference.wolfram.com/language/ref/StringTemplate.html) and [`StringReplace`](http://reference.wolfram.com/language/ref/StringReplace.html) to setup this URL pattern.

```
wikiURL = 
  StringTemplate["https://en.wikipedia.org/w/index.php?title=`1`", 
   InsertionFunction -> StringReplace[" " -> "_"]];

```

Finally, [`Map`](http://reference.wolfram.com/language/ref/Map.html) (`/@`) the template over the list of article titles for the list for the list of URLs. [`Hyperlink`](http://reference.wolfram.com/language/ref/Hyperlink.html) is used to create functioning hyperlinks.

```
{#, Hyperlink@wikiURL@#} & /@ titles

```

Hope this helps.
In version 0.8 of [jSoupLink](https://github.com/cekdahl/jSoupLink), you could do it like this:

```
doc = Import[
   "https://en.wikipedia.org/wiki/List_of_plants_used_in_herbalism", 
   "HTMLDOM"
];
herbs = doc["Select", "#mw-content-text > ul li"];

extractInformation[herb_] := {
  herb["AllText"],
  Through[herb["Select", "a"]["Attribute", "href"]]
  }
data = extractInformation /@ herbs;

```

We now have for example

```
data[[9]]

```

> 
> {"Astragalus (Astragalus propinquus) has long been used in
>  traditional Chinese medicine to strengthen the immune system, and is 
>  used in modern China to treat hepatitis and as an adjunctive therapy 
>  in cancer.[18]", {"/wiki/Astragalus", "/wiki/Astragalus\_propinquus",  
> 
>  "/wiki/Traditional\_Chinese\_medicine", "/wiki/Immune\_system",  
> 
>  "/wiki/Hepatitis", "/wiki/Cancer", "#cite\_note-18"}}
> 
> 
>