While working few web scrapping project, I was able to get the table data, but few of the data had few special characters in the table, which was in http encoded format. Related article is a Powershell web scrapping extract table from html. The encoded http data was not readable. This data can be encode or decode using PowerShell scripts easily. When you use special characters on html page, that character need to be converted/encoded. To read back it need to decoded.
Powershell has System.Web .net assembly need to be loaded in order to use the related commands. I have a test url with spaces, which I need to put inside the HTML report, it is not in the correct format when using inside HTML code page.
Add-Type -AssemblyName System.Web $date = (Get-Date).AddDays(-7).DateTime $url = "http://softcurry.com/$date" $url http://softcurry.com/23 August 2021 14:38:49
Related Articles:
Create an interactive HTML report with PowerShell data
PowerShell convert string to base64 value
To encode the data to be used on http webpage with special characters use below code with System.web.HttpUtility .net object. Method I am using is UrlEncode().
#Encode Url $encodedUrl = [System.Web.HttpUtility]::UrlEncode($url) $encodedUrl http%3a%2f%2fsoftcurry.com%2f23+August+2021+14%3a38%3a49
To decode the collected data from http web-scrapping back to readable format, use below code with method UrlDecode().
#Decode Url $decodedUrl = [System.Web.HttpUtility]::UrlDecode($encodedUrl) $decodedUrl http://softcurry.com/23 August 2021 14:38:49
Download this script here or it is also available on github.com.
Useful Articles
Powershell Convert range of numbers into another list of numbers maintaining ratio
Powershell Active Directory: List complete hierarchy of upstream nested groups recursively of User
Powershell Active Directory: Show treeview of User or Group memberof hierarchy
Powershell Active Directory: Show treeview of nested Group members downstream hierarchy
Oneliner Microsoft Powershell Script Get members from a list of group from Active Directory in excel
Powershell Active Directory 1: Check, enable and disable child OU protect object from accidental deletion
Oneliner Powershell how to add or remove AD user members and objects in groups