title: Retrieving and Parsing Text From Specific Webpage Using Swift
body: <p>I need to retrieve the text from a specific website. However, I only need a few parts of it. How can I accomplish this using swift. </p>
  
  <p>I have found the following in objective-c, but am not sure it provides how to reference it from a specific site: </p>
  
  <pre><code>NSString *webString = [webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.innerText"];
  NSScanner *stringScanner = [NSScanner scannerWithString:webString];
  NSString *content = [[NSString alloc] init];
  while ([stringScanner isAtEnd] == NO) {
  
  [stringScanner scanUpToString:@"Start of the text you want" intoString:null];
  [stringScanner scanUpToString:@"End of the text you want" intoString:&amp;content];
  }`
  </code></pre>
  
  <p>I have put an example of what I mean below: <a href="https://i.stack.imgur.com/gaohd.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gaohd.jpg" alt="enter image description here"></a></p>
  
  <p>Again, I would like to accomplish this using Swift. </p>