Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # скрипт PowerShell для открытия урла видео с меткой времени, из буфера памяти в PotPlayer
- # пример ссылки - https://vk.com/video-210600101_456239282?t=1h48m29s
- $url = $(Get-Clipboard)
- if ($url -like "*?t=*") {
- $hms = $url | Select-String -Pattern "(?<=t=)(\d{1,2})h?(\d{0,2})m?(\d{0,2})s?" -AllMatches
- $1 = $hms.Matches.Groups[1].Value
- $2 = $hms.Matches.Groups[2].Value
- $3 = $hms.Matches.Groups[3].Value
- if (($hms.Matches.Value -like "*h*") -and ($hms.Matches.Value -like "*m*")) {$time = (New-TimeSpan -Hours $1 -Minutes $2 -Seconds $3).TotalSeconds}
- elseif (($hms.Matches.Value -like "*h*") -and ($hms.Matches.Value -notlike "*m*")) {$time = (New-TimeSpan -Hours $1 -Seconds $2).TotalSeconds}
- elseif ($hms.Matches.Value -like "*m*") {$time = (New-TimeSpan -Minutes $1 -Seconds $3).TotalSeconds}
- else {$time = $1}
- }
- $link = & "E:\YT-DLP\yt-dlp.exe" -g $url
- Start-Process "D:\soft\UTILL\PotPlayer\PotPlayerMini64.exe" -ArgumentList "$link", "/user_agent=`"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36`"", "/seek=$time"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement