Skip to content

Commit

Permalink
Update javlibrary url scraper to work with custom baseurl (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvlflame committed Dec 26, 2020
1 parent fba887e commit 7a5d0d2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/Javinizer/Private/Get-JVUrlLocation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ function Get-JVUrlLocation {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)]
[PSObject]$Url
[PSObject]$Url,

[Parameter()]
[PSObject]$Settings
)

process {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Javinizer/Public/Get-JVData.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion src/Javinizer/Public/Get-JavlibraryUrl.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion src/Javinizer/Public/Javinizer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 7a5d0d2

Please sign in to comment.