Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $CustomObjs=@()
- $ISBN = "978-2-38275-162-6"
- $truncatedISBN = $ISBN -replace '-', ''
- $booksHtml = Invoke-WebRequest "https://isbnsearch.org/isbn/$truncatedISBN"
- $bookInfo = $booksHtml.ParsedHtml.getElementsByClassName("bookinfo")[0].innerText
- $cutBookInfo = $bookInfo.Split([System.Environment]::NewLine,[System.StringSplitOptions]::RemoveEmptyEntries)
- $name = $cutBookInfo[0]
- $author = $cutBookInfo[3].Substring($cutBookInfo[3].IndexOf(": ") + 2)
- $binding = $cutBookInfo[4].Substring($cutBookInfo[4].IndexOf(": ") + 2)
- $publisher = $cutBookInfo[5].Substring($cutBookInfo[5].IndexOf(": ") + 2)
- $published = $cutBookInfo[6].Substring($cutBookInfo[6].IndexOf(": ") + 2)
- $coverLink = $booksHtml.Images[0].src
- $CustomObj = New-Object -TypeName PSObject -Property @{ 'Name' = $name; 'ISBN' = $ISBN; "Author" = $author; "Binding" = $binding; "Publisher" = $publisher; "Published" = $published; "Cover" = $coverLink }
- $CustomObjs += $CustomObj
- $CustomObjs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement