Skip to content

Commit

Permalink
📺 Add YouTube video rating command
Browse files Browse the repository at this point in the history
  • Loading branch information
pcgeek86 committed Jan 30, 2022
1 parent 88d7f37 commit 7f1cd5a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions functions/Set-YouTubeVideoRating.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function Set-YouTubeVideoRating {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string] $VideoId,
[Parameter(Mandatory = $false)]
[ValidateSet('dislike','like','none')]
[string] $Rating = 'none'
)

$Request = @{
Uri = 'https://www.googleapis.com/youtube/v3/videos/rate?id={0}&rating={1}' -f $VideoId, $Rating
Method = 'Post'
Headers = (Get-AccessToken)
}
Invoke-RestMethod @Request
}
1 change: 1 addition & 0 deletions youtube.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'Remove-YouTubeSubscription'
'Get-YouTubeActivity'
'Get-YouTubeChannel'
'Set-YouTubeVideoRating'
)
AliasesToExport = @('')
VariablesToExport = @('')
Expand Down

0 comments on commit 7f1cd5a

Please sign in to comment.