Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $f = "/path/to/outbox.json" # outbox.jsonの絶対パス
- $obj = ConvertFrom-Json (Get-Content $f -Encoding utf8)
- $TootNumStart = 0 # 表示したいTootの開始連番
- $TootNumEnd = $obj.orderedItems.Count - 1 # 表示したいTootの終了連番
- $PublishedFrom = "1970/01/01" # 表示したいTootの開始日付
- $PublishedTo = "2099/12/31" # 表示したいTootの終了日付
- foreach ($TootNum In $TootNumStart..$TootNumEnd) {
- $obj.orderedItems.Item($TootNum).object `
- | ? {[DateTime]($_.published) -GE $PublishedFrom `
- -And [DateTime]($_.published) -LT ([DateTime]$PublishedTo).AddDays(1)} | % {
- write ("Toot# : {0}" -f $TootNum)
- write ("Url : {0}" -f $_.url)
- write ("Published : {0:yyyy/MM/dd HH:mm:ss}" -f [DateTime]($_.published))
- [regex]::matches($_.content,"(?:<p>(.+?)</p>)").Captures | % {
- write "Content : "
- }{
- $content = (($_.Groups[1].Value -replace "<a[^>]*>(.+?)</a>","`$1") `
- -replace "<span[^>]*>(.*?)</span>","`$1") -replace "<br />","`n"
- write "$content`n"
- }
- }
- }
RAW Paste Data