$js = Get-Content js\main.js -Raw
$pattern = "id:\s*'([^']+)'[\s\S]*?gallery:\s*\[([^\]]+)\]"
$matches = [regex]::Matches($js,$pattern)
$out='gallery_list.txt'; '' | Out-File $out -Force
foreach($m in $matches){ $id=$m.Groups[1].Value; $galleryRaw=$m.Groups[2].Value; $items = [regex]::Matches($galleryRaw,"'([^']+)'") | ForEach-Object { $_.Groups[1].Value }
    $i=0; foreach($it in $items){ $i++; "$id|$i|$it" | Out-File $out -Append }
}
Write-Output "Wrote $out with $((Get-Content $out|Measure-Object).Count) entries"