Skip to content

Instantly share code, notes, and snippets.

@t2psyto
Created January 29, 2022 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save t2psyto/30c4068eb202989efc1503ae74dd7cb8 to your computer and use it in GitHub Desktop.
Save t2psyto/30c4068eb202989efc1503ae74dd7cb8 to your computer and use it in GitHub Desktop.
class FunClass {
[Array] funcSearch($argv1, $argv2, $argv3) {
#return "ACTION=3&ONLINE_MEDIA=%28%40kind%3D%3D1%26%40announcemediaid%3D%3D24%26%40writemediaid%3D%3D16%29%26%28%40subsubject%3A%3D0272H%29&SEARCH_START_DATE=20201101&SEARCH_END_DATE=20201101&j_encoding=UTF-8&NO_TERM_SEARCH=1&MAGAZINE_GET_COUNT=100";
$param_body = "ACTION=3&ONLINE_MEDIA=%28%40kind%3D%3D1%26%40announcemediaid%3D%3D24%26%40writemediaid%3D%3D" + $argv1 + "%29%26%28%40subsubject%3A%3D" + $argv3 + "%29&SEARCH_START_DATE=" + $argv2 + "&SEARCH_END_DATE=" + $argv2 + "&j_encoding=UTF-8&NO_TERM_SEARCH=1&MAGAZINE_GET_COUNT=100";
#return $argv3 + $argv2 + $argv1
$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
$session.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36"
$session.Cookies.Add((New-Object System.Net.Cookie("SEARCH_RESULT_SELECTED", "`"COUNT=50`"", "/", ".bizboard.nikkeibp.co.jp")))
$ret3 = Invoke-WebRequest -UseBasicParsing -Uri "http://bizboard.nikkeibp.co.jp/simple_notauth/SearchServlet" `
-Method "POST" `
-WebSession $session `
-Headers @{
"Cache-Control"="max-age=0"
"Origin"="http://bizboard.nikkeibp.co.jp"
"Upgrade-Insecure-Requests"="1"
"DNT"="1"
"Accept"="text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
"Referer"="http://bizboard.nikkeibp.co.jp/simple/parts/mag_NSW2020.html"
"Accept-Encoding"="gzip, deflate"
"Accept-Language"="ja-JP,ja;q=0.9,en-US;q=0.8,en;q=0.7"
} `
-ContentType "application/x-www-form-urlencoded" `
-Body $param_body;
$ret4 = $($ret3.Links | sls "http://bizboard.nikkeibp.co.jp/houjin/cgi-bin/nsearch/md_pdf.pl/[0-9]+.pdf\?NEWS_ID=[0-9]+&CONTENTS=1&bt=[A-Z]+&SYSTEM_ID=HO" | % { $_.Matches.Value })
return $ret4
}
}
$obj = New-Object FunClass
$obj.funcSearch( '16', '20201101', '0272H')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment