Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #9782368528310" #9782368528310 #9782382750216 #9782382751626 #9782871293545
- $ISBN = "2382751622"
- $req = Invoke-RestMethod -Method "GET" -URI "https://www.googleapis.com/books/v1/volumes?q=isbn:$ISBN"
- $infos = $req.items.volumeInfo
- $authors = $infos.authors
- $title = $infos.title
- $publishedDate = $infos.publishedDate
- $pageCount = $infos.pageCount
- $printType = $infos.printType
- $maturityRating = $infos.maturityRating
- $language = $infos.language
- $publisher = $infos.publisher
- $coverLink = ""
- $parsedHtml = (Invoke-WebRequest $req.items.volumeInfo.infoLink).ParsedHtml
- $additionalInfos = ($parsedHtml.getElementsByTagName('td') | Where-Object { $_.className -eq 'metadata_value' }).innerText
- If ([String]::IsNullOrEmpty($req.items.volumeInfo.Authors)) {
- $authors = $additionalInfos[1]
- }
- If ([String]::IsNullOrEmpty($req.items.volumeInfo.publisher)) {
- $publisher = $additionalInfos[2].Substring(0, $additionalInfos[2].IndexOf(","))
- }
- If ([String]::IsNullOrEmpty($req.items.volumeInfo.pageCount) -Or $req.items.volumeInfo.pageCount -eq "0") {
- $pageCount = $additionalInfos[4]
- }
- write-host $authors
- write-host $title
- write-host $publishedDate
- write-host $pageCount
- write-host $printType
- write-host $maturityRating
- write-host $language
- write-host $publisher
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement