Skip to content

Instantly share code, notes, and snippets.

@tackme31
Created June 28, 2022 16:03
Show Gist options
  • Save tackme31/c679bc489dc45806328febbd0b58c52d to your computer and use it in GitHub Desktop.
Save tackme31/c679bc489dc45806328febbd0b58c52d to your computer and use it in GitHub Desktop.
ホームズの物件で募集中の部屋を出力するやつ
$chintaiList = @(
'https://www.homes.co.jp/archive/b-38203506/', # キングダム相模原
'https://www.homes.co.jp/archive/b-38203509/', # ビバーチェ
'https://www.homes.co.jp/archive/b-38201560/' # タウンハウス内堀
)
function Write-Recuruitments($archiveUrl) {
$result = Invoke-WebRequest $archiveUrl
$heading = $result.ParsedHtml.getElementsByClassName('heading')
$title = $heading[0].innerText -replace 'の賃貸・中古情報','' -replace 'の賃貸情報',''
Write-Output $title
$recruitments = $result.ParsedHtml.getElementsByClassName('is-inquire')
$recruitments | ForEach-Object {
$floorElem = $_.querySelector('.floarCell')
$floorElem.innerText -match '(\d+階)' > $null
$floor = $Matches[0]
$urlElem = $_.querySelector('.roomImage a')
$url = $urlElem.href
Write-Output "$floor : $url"
}
}
$chintaiList | ForEach-Object {
Write-Recuruitments $_
Write-Output ''
Write-Output '-----'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment