Skip to content

Commit

Permalink
Fix DMM ContentID matcher (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvlflame committed Dec 22, 2020
1 parent 5e56fa3 commit e832cfb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Javinizer/Private/Scraper.Dmm.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function Get-DmmContentId {

process {
try {
$contentId = (((($Webrequest.Content -split '<td align="right" valign="top" class="nw">(品番:|Movie Number:)<\/td>')[2] -split '\/td>')[0]) | Select-String -Pattern '>(.*)<').Matches.Groups[1].Value
$contentId = ($Webrequest.Content | Select-String -Pattern 'var gaContentId = "(.*)";').Matches.Groups[1].Value
} catch {
return
}
Expand All @@ -26,7 +26,7 @@ function Get-DmmId {
$contentId = Get-DmmContentId $Webrequest
$m = ($contentId | Select-String -Pattern '\d*([a-z]+)(\d+)(.*)$' -AllMatches).Matches

if($m.Groups.Count -gt 2 -and $m.Groups[1] -and $m.Groups[2]) {
if ($m.Groups.Count -gt 2 -and $m.Groups[1] -and $m.Groups[2]) {
$Id = $m.Groups[1].Value.ToUpper() + "-" + ($m.Groups[2].Value -replace '^0{1,5}', '').PadLeft(3, '0') + $m.Groups[3].Value.ToUpper()
}
} catch {
Expand Down
4 changes: 2 additions & 2 deletions src/Javinizer/Public/Get-DmmUrl.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ function Get-DmmUrl {
Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$originalId] [$($MyInvocation.MyCommand.Name)] Error occurred on [GET] on URL [$result]: $PSItem" -Action 'Continue'
}

$resultId = Get-DmmContentId -WebRequest $webRequest
$resultId = Get-DmmId -WebRequest $webRequest
Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$originalId] [$($MyInvocation.MyCommand.Name)] Result [$count] is [$resultId]"
if ($resultId -match "^(.*_)?\d*$Id") {
if ($resultId -eq "$Id") {
$directUrl = $result
break
}
Expand Down

0 comments on commit e832cfb

Please sign in to comment.