Advertisement
FiLinX

yt-dlp_PotPlayer.ps1

Aug 25th, 2023 (edited)
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. # скрипт PowerShell для открытия урла видео с меткой времени, из буфера памяти в PotPlayer
  2. # пример ссылки - https://vk.com/video-210600101_456239282?t=1h48m29s
  3.  
  4. $url = $(Get-Clipboard)
  5. if ($url -like "*?t=*") {
  6. $hms = $url | Select-String -Pattern "(?<=t=)(\d{1,2})h?(\d{0,2})m?(\d{0,2})s?" -AllMatches
  7. $1 = $hms.Matches.Groups[1].Value
  8. $2 = $hms.Matches.Groups[2].Value
  9. $3 = $hms.Matches.Groups[3].Value
  10. if (($hms.Matches.Value -like "*h*") -and ($hms.Matches.Value -like "*m*")) {$time = (New-TimeSpan -Hours $1 -Minutes $2 -Seconds $3).TotalSeconds}
  11. elseif (($hms.Matches.Value -like "*h*") -and ($hms.Matches.Value -notlike "*m*")) {$time = (New-TimeSpan -Hours $1 -Seconds $2).TotalSeconds}
  12. elseif ($hms.Matches.Value -like "*m*") {$time = (New-TimeSpan -Minutes $1 -Seconds $3).TotalSeconds}
  13. else {$time = $1}
  14. }
  15. $link = & "E:\YT-DLP\yt-dlp.exe" -g $url
  16. 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