{"id":13,"date":"2014-07-17T13:18:59","date_gmt":"2014-07-17T12:18:59","guid":{"rendered":"http:\/\/banfi.co.uk\/blog\/?p=13"},"modified":"2014-07-17T22:17:50","modified_gmt":"2014-07-17T21:17:50","slug":"scraping-webpages-and-displaying-data-from-it","status":"publish","type":"post","link":"https:\/\/banfi.co.uk\/blog\/2014\/07\/scraping-webpages-and-displaying-data-from-it\/","title":{"rendered":"Scraping webpages and displaying data from it&#8230;"},"content":{"rendered":"<p>When you are working on a project to get data from a webpage but you don&#8217;t have access to the back-end database or a API to get any values out.<\/p>\n<p>The workaround I use until something changes is Web scraping.<\/p>\n<p>I have a project with this problem &#8211; it&#8217;s another VB.NET one.<\/p>\n<p>My Scraping code goes along like this &#8211;<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n'Get the URL \/ Navigate a browser window too it (this is hidden in my project\r\nWebBrowser.Navigate(&quot;http:\/\/website.com\/pageiwanttoscrape.aspx&quot;)\r\n\r\n'Convert the HTML of the page to a string using the body.outerhtml function\r\nwebPage1 = WebBrowser.Document.Body.OuterHtml\r\n\r\n'Use the InString function to search for a term in the webPage1 string\r\nIf InStr(webPage1, &quot;term to search&quot;) &lt;&gt; 0 Then\r\n'get the position of the term to search\r\n            StringSearch = InStr(webPage1, &quot;term to search&quot;)\r\n'pick some deatails out of the page using the position + x and capture the next n letters\r\n            ScrapedText = Mid(webPage1, StringSearch + x, n)\r\n'tidy up anything we don't like out of the returned string \r\n            ScrapedText = ScrapedText.Replace(&quot;.&quot;, &quot;&quot;)\r\n'now we have the scraped text we can use it in our app\r\n       \r\n\r\n        End If\r\n<\/pre>\n<p>Ta-da &#8211; workaround using scraping.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you are working on a project to get data from a webpage but you don&#8217;t have access to the back-end database or a API to get any values out. The workaround I use until something changes is Web scraping. I have a project with this problem &#8211; it&#8217;s another VB.NET one. My Scraping code &hellip; <a href=\"https:\/\/banfi.co.uk\/blog\/2014\/07\/scraping-webpages-and-displaying-data-from-it\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Scraping webpages and displaying data from it&#8230;<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4,5,7],"tags":[],"class_list":["post-13","post","type-post","status-publish","format-standard","hentry","category-net","category-vb-net","category-webcode"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/banfi.co.uk\/blog\/wp-json\/wp\/v2\/posts\/13","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/banfi.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/banfi.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/banfi.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/banfi.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=13"}],"version-history":[{"count":7,"href":"https:\/\/banfi.co.uk\/blog\/wp-json\/wp\/v2\/posts\/13\/revisions"}],"predecessor-version":[{"id":20,"href":"https:\/\/banfi.co.uk\/blog\/wp-json\/wp\/v2\/posts\/13\/revisions\/20"}],"wp:attachment":[{"href":"https:\/\/banfi.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=13"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/banfi.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=13"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/banfi.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=13"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}