How to extract data from URL/ HTML?

Im trying to extract the IP address that is nested in html and print it out to a string.



<ul>

<li>IP Address:

<span class="darktext">199.123.456.789</span>

</li>

<li>Internet Service Provider:

<span class="darktext">Optimum WiFi</span>

</li>

<li>City:

<span class="darktext">My City</span>

</li>

<li>State/Region:

<span class="darktext">New City</span>

</li>

<li>Country:

<span class="darktext">United States</span>

</li>

<li>Browser:

<span class="darktext">TextFromURL</span>

</li>

<li>Operating System:

<span class="darktext"></span>

</li>

<li>Screen Resolution:

<span id="resolution" class="darktext"></span>

</li>

</ul>

Replies

Im trying to extract the IP address that is nested in html and print it out to a string.

You’re trying to parse HTML to extract data, a process known as web scraping. This is very hard to do unless you have some mechanism to constrain the problem. See this post for more.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"