From 7a5d0d21ba9fc75dc2528a3540abfe0def7669db Mon Sep 17 00:00:00 2001 From: jvlflame Date: Fri, 25 Dec 2020 18:09:00 -0800 Subject: [PATCH] Update javlibrary url scraper to work with custom baseurl (#169) --- src/Javinizer/Private/Get-JVUrlLocation.ps1 | 7 +++++-- src/Javinizer/Public/Get-JVData.ps1 | 2 +- src/Javinizer/Public/Get-JavlibraryUrl.ps1 | 2 +- src/Javinizer/Public/Javinizer.ps1 | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Javinizer/Private/Get-JVUrlLocation.ps1 b/src/Javinizer/Private/Get-JVUrlLocation.ps1 index 32bdc80a..11e28732 100644 --- a/src/Javinizer/Private/Get-JVUrlLocation.ps1 +++ b/src/Javinizer/Private/Get-JVUrlLocation.ps1 @@ -2,7 +2,10 @@ function Get-JVUrlLocation { [CmdletBinding()] param ( [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)] - [PSObject]$Url + [PSObject]$Url, + + [Parameter()] + [PSObject]$Settings ) process { @@ -20,7 +23,7 @@ function Get-JVUrlLocation { Source = 'r18' } } - } elseif ($link -match 'javlibrary.com' -or $link -match 'g46e.com' -or $link -match 'm45e.com') { + } elseif ($link -match 'javlibrary.com' -or $link -match 'g46e.com' -or $link -match 'm45e.com' -or $link -or $link -match ($Settings.'javlibrary.baseurl' -replace 'http(s)?:\/\/')) { if ($link -match '/ja/') { $testUrlObject += [PSCustomObject]@{ Url = $link diff --git a/src/Javinizer/Public/Get-JVData.ps1 b/src/Javinizer/Public/Get-JVData.ps1 index 1e71d2c1..6259c150 100644 --- a/src/Javinizer/Public/Get-JVData.ps1 +++ b/src/Javinizer/Public/Get-JVData.ps1 @@ -103,7 +103,7 @@ function Get-JVData { $Id = $Id.ToUpper() if ($Url) { - $urlObject = $Url | Get-JVUrlLocation + $urlObject = $Url | Get-JVUrlLocation -Settings $Settings } elseif ($Settings) { $R18 = $Settings.'scraper.movie.r18' $R18Zh = $Settings.'scraper.movie.r18zh' diff --git a/src/Javinizer/Public/Get-JavlibraryUrl.ps1 b/src/Javinizer/Public/Get-JavlibraryUrl.ps1 index 108c2d4a..edc2136a 100644 --- a/src/Javinizer/Public/Get-JavlibraryUrl.ps1 +++ b/src/Javinizer/Public/Get-JavlibraryUrl.ps1 @@ -76,7 +76,7 @@ function Get-JavlibraryUrl { Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Result [$count] is [$resultId]" if ($resultId -eq $Id) { - $javlibraryUrl = (Get-JVUrlLocation -Url $webRequest.BaseResponse.RequestMessage.RequestUri.AbsoluteUri).Url + $javlibraryUrl = $directUrl break } diff --git a/src/Javinizer/Public/Javinizer.ps1 b/src/Javinizer/Public/Javinizer.ps1 index a5130766..ae04b934 100644 --- a/src/Javinizer/Public/Javinizer.ps1 +++ b/src/Javinizer/Public/Javinizer.ps1 @@ -584,7 +584,7 @@ function Javinizer { switch ($PsCmdlet.ParameterSetName) { 'Info' { if ($Find -match 'https?:\/\/') { - $urlObject = Get-JVUrlLocation -Url $Find + $urlObject = Get-JVUrlLocation -Url $Find -Settings $Settings $data = foreach ($item in $urlObject) { if ($item.Source -match 'dmm') { $item.Url | Get-DmmData -ScrapeActress:$Settings.'scraper.option.dmm.scrapeactress'