Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function search-custom() {
- Param(
- [Parameter(Mandatory = $true)][string]$search,
- [AllowEmptyString()] $customsearch_id = "006759091738829999417%3A-ynq7qhchoc",
- [AllowEmptyString()]$api_key="<your key>"
- )
- try {
- $Search_results = invoke-restmethod "https://www.googleapis.com/customsearch/v1?q=$search&cr=us&cx=$customsearch_id&key=$api_key"
- $search_results = ($search_results.items) | select title, snippet,link
- return $search_results
- } catch {
- return $false
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement