Skip to content

Commit

Permalink
Fixed regex for ID with suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
seeyabye committed Sep 27, 2020
1 parent 6fa2ccb commit 7b22c44
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/Javinizer/Private/Scraper.Dmm.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ function Get-DmmId {
# Expects ###ID##### or ID#####
$contentId = Get-DmmContentId $Webrequest
$Id = $contentId
$m = ($contentId | Select-String -Pattern '\d*([a-z]+)(\d+)$' -AllMatches).Matches
$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]) {
$Id = $m.Groups[1].Value.ToUpper() + "-" + ($m.Groups[2].Value -replace '^0{1,5}', '').PadLeft(3, '0')
$Id = $m.Groups[1].Value.ToUpper() + "-" + ($m.Groups[2].Value -replace '^0{1,5}', '').PadLeft(3, '0') + $m.Groups[3].Value.ToUpper()
}
} catch {
return
Expand Down
13 changes: 7 additions & 6 deletions src/Javinizer/Public/Get-DmmData.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ function Get-DmmData {

process {
$movieDataObject = @()
$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
$cookie = New-Object System.Net.Cookie
$cookie.Name = 'age_check_done'
$cookie.Value = '1'
$cookie.Domain = 'dmm.co.jp'
$session.Cookies.Add($cookie)

if ($Url -match '/en/') {
$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
$cookie = New-Object System.Net.Cookie
$cookie.Name = 'ckcy'
$cookie.Value = '2'
Expand All @@ -24,11 +30,6 @@ function Get-DmmData {
$cookie.Value = 'en'
$cookie.Domain = 'dmm.co.jp'
$session.Cookies.Add($cookie)
$cookie = New-Object System.Net.Cookie
$cookie.Name = 'age_check_done'
$cookie.Value = '1'
$cookie.Domain = 'dmm.co.jp'
$session.Cookies.Add($cookie)
}

try {
Expand Down

0 comments on commit 7b22c44

Please sign in to comment.