Skip to content

Commit

Permalink
Update rating scraper to null on empty
Browse files Browse the repository at this point in the history
  • Loading branch information
jvlflame committed Dec 13, 2020
1 parent a0caea7 commit 0925077
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
10 changes: 7 additions & 3 deletions src/Javinizer/Private/Scraper.Dmm.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,13 @@ function Get-DmmRating {
$ratingCount = (($Webrequest.Content -split '<p class="d-review__evaluates">')[1] -split '<\/p>')[0]
$ratingCount = (($ratingCount -split '<strong>')[1] -split '<\/strong>')[0]

$ratingObject = [PSCustomObject]@{
Rating = $rating
Votes = $ratingCount
if ($ratingCount -eq 0) {
$ratingObject = $null
} else {
$ratingObject = [PSCustomObject]@{
Rating = $rating
Votes = $ratingCount
}
}

Write-Output $ratingObject
Expand Down
12 changes: 9 additions & 3 deletions src/Javinizer/Private/Scraper.Javlibrary.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,16 @@ function Get-JavlibraryRating {
process {
$rating = (((($Webrequest.Content -split '<div id="video_review" class="item">')[1]) -split '<\/span>')[0] -split '<span class="score">')[1]
$rating = ($rating -replace '\(', '') -replace '\)', ''
$ratingObject = [PSCustomObject]@{
Rating = $rating
Votes = $null

if ($rating -eq 0) {
$ratingObject = $null
} else {
$ratingObject = [PSCustomObject]@{
Rating = $rating
Votes = $null
}
}

Write-Output $ratingObject
}
}
Expand Down

0 comments on commit 0925077

Please sign in to comment.