diff --git a/src/Javinizer/Public/Get-DmmUrl.ps1 b/src/Javinizer/Public/Get-DmmUrl.ps1 index 9f535953..02752927 100644 --- a/src/Javinizer/Public/Get-DmmUrl.ps1 +++ b/src/Javinizer/Public/Get-DmmUrl.ps1 @@ -22,10 +22,10 @@ function Get-DmmUrl { $searchUrl = "https://www.dmm.co.jp/search/?redirect=1&enc=UTF-8&category=&searchstr=$Id" try { - Write-JLog -Level Debug -Message "Performing [GET] on URL [$searchUrl]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl]" $webRequest = Invoke-WebRequest -Uri $searchUrl -Method Get -Verbose:$false } catch { - Write-JLog -Level Error -Message "Error [GET] on URL [$searchUrl]" + Write-JLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occurred on [GET] on URL [$searchUrl]" } $retryCount = 3 @@ -37,19 +37,19 @@ function Get-DmmUrl { } if ($numResults -ge 1) { - Write-JLog -Level Debug -Message "Searching [$retryCount] of [$numResults] results for [$Id]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Searching [$retryCount] of [$numResults] results for [$Id]" $count = 1 foreach ($result in $searchResults) { try { - Write-JLog -Level Debug -Message "Performing [GET] on URL [$result]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$result]" $webRequest = Invoke-WebRequest -Uri $result -Method Get -Verbose:$false } catch { - Write-JLog -Level Error -Message "Error [GET] on URL [$result]: $PSItem" + Write-JLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occurred on [GET] on URL [$result]: $PSItem" } $resultId = Get-DmmContentId -WebRequest $webRequest - Write-JLog -Level Debug -Message "Result [$count] is [$resultId]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Result [$count] is [$resultId]" if ($resultId -match $Id) { $directUrl = $result break @@ -65,14 +65,14 @@ function Get-DmmUrl { } if ($null -eq $directUrl) { - Write-JLog -Level Warning -Message "Search [$Id] not matched on DMM" + Write-JLog -Level Warning -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Search [$Id] not matched on DMM" return } else { $urlObject = [PSCustomObject]@{ Url = $directUrl Language = 'ja' } - + Write-Output $urlObject } } diff --git a/src/Javinizer/Public/Get-JVData.ps1 b/src/Javinizer/Public/Get-JVData.ps1 index 775478fb..f7c5e5ac 100644 --- a/src/Javinizer/Public/Get-JVData.ps1 +++ b/src/Javinizer/Public/Get-JVData.ps1 @@ -39,6 +39,7 @@ function Get-JVData { process { $javinizerDataObject = @() + $Id = $Id.ToUpper() if ($Settings) { $R18 = $Settings.'scraper.movie.r18' @@ -135,11 +136,11 @@ function Get-JVData { } # Wait-Job is used separately rather than in a pipeline due to the PowerShell.Exit job that is being created during the first-run of this function - Write-Debug "[$Id] [$($MyInvocation.MyCommand.Name)] Waiting for jobs to complete" + Write-Debug "[$Id] [$($MyInvocation.MyCommand.Name)] Waiting for scraper jobs to complete" $jobId = @((Get-Job | Where-Object { $_.Name -like "$Id*" } | Select-Object Id).Id) Wait-Job -Id $jobId | Out-Null - Write-Debug "[$Id] [$($MyInvocation.MyCommand.Name)] Jobs completed" + Write-Debug "[$Id] [$($MyInvocation.MyCommand.Name)] Scraper jobs completed" $javinizerDataObject = Get-Job -Id $jobId | Receive-Job $hasData = ($javinizerDataObject | Select-Object Source).Source diff --git a/src/Javinizer/Public/Get-Jav321Url.ps1 b/src/Javinizer/Public/Get-Jav321Url.ps1 index 595e97ba..448b8fbd 100644 --- a/src/Javinizer/Public/Get-Jav321Url.ps1 +++ b/src/Javinizer/Public/Get-Jav321Url.ps1 @@ -9,11 +9,10 @@ function Get-Jav321Url { $searchUrl = "https://jp.jav321.com/search" try { - Write-JLog -Level Debug -Message "Performing [GET] on URL [$searchUrl]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl]" $webRequest = Invoke-WebRequest -Uri $searchUrl -Method Post -Body "sn=$Id" -Verbose:$false } catch { - Write-JLog -Level Error -Message "Error [GET] on URL [$searchUrl]: $PSItem" - return + Write-JLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$searchUrl]: $PSItem" } @@ -31,16 +30,16 @@ function Get-Jav321Url { } if ($numResults -ge 1) { - Write-JLog -Level Debug -Message "Searching [$Tries] of [$numResults] results for [$Id]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Searching [$Tries] of [$numResults] results for [$Id]" $count = 1 foreach ($result in $searchResults) { $result = "https://jp.jav321.com/video/$result" try { - Write-JLog -Level Debug -Message "Performing [GET] on URL [$result]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$result]" $webRequest = Invoke-RestMethod -Uri $result -Method Get -Verbose:$false } catch { - Write-JLog -Level Error -Message "Error [GET] on URL [$result]: $PSItem" + Write-JLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$result]: $PSItem" } $resultId = Get-Jav321Id -WebRequest $webRequest @@ -49,7 +48,7 @@ function Get-Jav321Url { break } - Write-JLog -Level Debug -Message "Result [$count] is [$resultId]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Result [$count] is [$resultId]" if ($count -eq $Tries) { break } @@ -58,7 +57,7 @@ function Get-Jav321Url { } if ($null -eq $directUrl) { - Write-JLog -Level Warning -Message "Search [$Id] not matched on Jav321" + Write-JLog -Level Warning -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Search [$Id] not matched on Jav321" return } else { $urlObject = [PSCustomObject]@{ @@ -68,7 +67,7 @@ function Get-Jav321Url { Write-Output $urlObject } } else { - Write-JLog -Level Warning -Message "Search [$Id] not matched on Jav321" + Write-JLog -Level Warning -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Search [$Id] not matched on Jav321" return } } diff --git a/src/Javinizer/Public/Get-JavbusUrl.ps1 b/src/Javinizer/Public/Get-JavbusUrl.ps1 index 9b18211c..dfc60894 100644 --- a/src/Javinizer/Public/Get-JavbusUrl.ps1 +++ b/src/Javinizer/Public/Get-JavbusUrl.ps1 @@ -12,20 +12,20 @@ function Get-JavbusUrl { $searchUrl = "https://www.javbus.com/search/$Id&type=0&parent=uc" try { - Write-JLog -Level Debug -Message "Performing [GET] on URL [$searchUrl]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl]" $webRequest = Invoke-RestMethod -Uri $searchUrl -Method Get -Verbose:$false } catch { try { $searchUrl = "https://www.javbus.com/uncensored/search/$Id&type=0&parent=uc" - Write-JLog -Level Debug -Message "Performing [GET] on URL [$searchUrl]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl]" $webRequest = Invoke-RestMethod -Uri $searchUrl -Method Get -Verbose:$false } catch { try { $searchUrl = "https://www.javbus.org/search/$Id&type=0&parent=uc" - Write-JLog -Level Debug -Message "Performing [GET] on URL [$searchUrl]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl]" $webRequest = Invoke-RestMethod -Uri $searchUrl -Method Get -Verbose:$false } catch { - Write-JLog -Level Warning -Message "Search [$Id] not matched on JavBus" + Write-JLog -Level Warning -Message "[$Id] not matched on JavBus" return } } @@ -45,15 +45,15 @@ function Get-JavbusUrl { } if ($numResults -ge 1) { - Write-JLog -Level Debug -Message "Searching [$Tries] of [$numResults] results for [$Id]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Searching [$Tries] of [$numResults] results for [$Id]" $count = 1 foreach ($result in $searchResults) { try { - Write-JLog -Level Debug -Message "Performing [GET] on URL [$result]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$result]" $webRequest = Invoke-RestMethod -Uri $result -Method Get -Verbose:$false } catch { - Write-JLog -Level Error -Message "Error [GET] on URL [$result]: $PSItem" + Write-JLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occurred on [GET] on URL [$result]: $PSItem" } $resultId = Get-JavbusId -WebRequest $webRequest if ($resultId -eq $Id) { @@ -75,7 +75,7 @@ function Get-JavbusUrl { } if ($null -eq $directUrl) { - Write-JLog -Level Warning -Message "Search [$Id] not matched on JavBus" + Write-JLog -Level Warning -Message "[$Id] not matched on JavBus" return } else { $urlObject = [PSCustomObject]@{ diff --git a/src/Javinizer/Public/Get-JavlibraryUrl.ps1 b/src/Javinizer/Public/Get-JavlibraryUrl.ps1 index 43c73473..f4a4afea 100644 --- a/src/Javinizer/Public/Get-JavlibraryUrl.ps1 +++ b/src/Javinizer/Public/Get-JavlibraryUrl.ps1 @@ -12,10 +12,10 @@ function Get-JavlibraryUrl { $searchUrl = "http://www.javlibrary.com/en/vl_searchbyid.php?keyword=$Id" try { - Write-JLog -Level Debug -Message "Performing [GET] on URL [$searchUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]" $webRequest = Invoke-WebRequest -Uri $searchUrl -Method Get -WebSession $Session -UserAgent $Session.UserAgent -Verbose:$false } catch { - Write-JLog -Level Error -Message "Error [GET] on URL [$searchUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]: $PSItem" + Write-JLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$searchUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]: $PSItem" } # Check if the search uniquely matched a video page @@ -23,14 +23,14 @@ function Get-JavlibraryUrl { $searchResultUrl = $webRequest.BaseResponse.RequestMessage.RequestUri.AbsoluteUri if ($searchResultUrl -match 'http:\/\/www\.javlibrary\.com\/en\/\?v=') { try { - Write-JLog -Level Debug -Message "Performing [GET] on URL [$searchResultUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchResultUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]" $webRequest = Invoke-WebRequest -Uri $searchResultUrl -Method Get -WebSession $Session -UserAgent $Session.UserAgent -Verbose:$false } catch { - Write-JLog -Level Error -Message "Error [GET] on URL [$searchResultUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]: $PSItem" + Write-JLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$searchResultUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]: $PSItem" } $resultId = Get-JavlibraryId -WebRequest $webRequest - Write-JLog -Level Debug -Message "Result is [$resultId]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Result is [$resultId]" if ($resultId -eq $Id) { $javlibraryUrl = $searchResultUrl } @@ -52,14 +52,14 @@ function Get-JavlibraryUrl { $directUrl = "http://www.javlibrary.com/en/?v=$videoId" try { - Write-JLog -Level Debug -Message "Performing [GET] on URL [$directUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$directUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]" $webRequest = Invoke-WebRequest -Uri $directUrl -Method Get -WebSession $Session -UserAgent $Session.UserAgent -Verbose:$false } catch { - Write-JLog -Level Error -Message "Error [GET] on URL [$directUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]: $PSItem" + Write-JLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$directUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]: $PSItem" } $resultId = Get-JavlibraryId -WebRequest $webRequest - Write-JLog -Level Debug -Message "Result [$count] is [$resultId]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Result [$count] is [$resultId]" if ($resultId -eq $Id) { $javlibraryUrl = (Test-UrlLocation -Url $webRequest.BaseResponse.RequestMessage.RequestUri.AbsoluteUri).Url @@ -76,7 +76,7 @@ function Get-JavlibraryUrl { } if ($null -eq $javlibraryUrl) { - Write-JLog -Level Warning -Message "Search [$Id] not matched on JAVLibrary" + Write-JLog -Level Warning -Message "[$Id] not matched on JavLibrary" return } else { if ($Language -eq 'ja') { diff --git a/src/Javinizer/Public/Get-R18Url.ps1 b/src/Javinizer/Public/Get-R18Url.ps1 index 8c4e9347..08241293 100644 --- a/src/Javinizer/Public/Get-R18Url.ps1 +++ b/src/Javinizer/Public/Get-R18Url.ps1 @@ -33,10 +33,10 @@ function Get-R18Url { # Try matching the video with Video ID try { - Write-JLog -Level Debug -Message "Performing [GET] on Uri [$searchUrl]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl]" $webRequest = Invoke-WebRequest -Uri $searchUrl -Method Get -Verbose:$false } catch { - Write-JLog -Level Error -Message "Error [GET] on URL [$searchUrl]: $PSItem" + Write-JLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$searchUrl]: $PSItem" } $retryCount = 3 @@ -53,10 +53,10 @@ function Get-R18Url { $count = 1 foreach ($result in $searchResults) { try { - Write-JLog -Level Debug -Message "Performing [GET] on URL [$result]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$result]" $webRequest = Invoke-WebRequest -Uri $result -Method Get -Verbose:$false } catch { - Write-JLog -Level Error -Message "Error [GET] on URL [$result]: $PSItem" + Write-JLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$result]: $PSItem" } $resultId = Get-R18Id -WebRequest $webRequest @@ -79,10 +79,10 @@ function Get-R18Url { $searchUrl = "https://www.r18.com/common/search/searchword=$contentId/" try { - Write-JLog -Level Debug -Message "Performing [GET] on URL [$searchUrl]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl]" $webRequest = Invoke-WebRequest -Uri $searchUrl -Method Get -Verbose:$false } catch { - Write-JLog -Level Error -Message "Error [GET] on URL [$searchUrl]: $PSItem" + Write-JLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$searchUrl]: $PSItem" } $retryCount = 5 @@ -96,10 +96,10 @@ function Get-R18Url { $count = 1 foreach ($result in $altSearchResults) { try { - Write-JLog -Level Debug -Message "Performing [GET] on URL [$result]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$result]" $webRequest = Invoke-WebRequest -Uri $result -Method Get -Verbose:$false } catch { - Write-JLog -Level Error -Message "Error [GET] on URL [$result]: $PSItem" + Write-JLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$result]: $PSItem" } $resultId = Get-R18Id -WebRequest $webRequest @@ -122,7 +122,7 @@ function Get-R18Url { $testUrl = "https://www.r18.com/videos/vod/movies/detail/-/id=$contentId/" try { - Write-JLog -Level Debug -Message "Performing [GET] on Uri [$testUrl]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on Uri [$testUrl]" $webRequest = Invoke-WebRequest -Uri $testUrl -Method Get -Verbose:$false } catch { $webRequest = $null @@ -130,7 +130,7 @@ function Get-R18Url { if ($null -ne $webRequest) { $resultId = Get-R18Id -WebRequest $webRequest - Write-JLog -Level Debug -Message "Result is [$resultId]" + Write-JLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Result is [$resultId]" if ($resultId -eq $Id) { $directUrl = $testUrl } @@ -138,7 +138,7 @@ function Get-R18Url { } if ($null -eq $directUrl) { - Write-JLog -Level Warning -Message "Search [$Id] not matched on R18" + Write-JLog -Level Warning -Message "[$Id] not matched on R18" return } else { if ($Language -eq 'zh') {