Surprise! We've been running on hardware provided by BuyVM for a few months and wanted to show them a little appreciation.
Running a paste site comes with unique challenges, ones that aren't always obvious and hard to control. As such, BuyVM offered us a home where we could worry less about the hosting side of things and focus on maintaining a clean and useful service! Go check them out and show them some love!
Submitted on September 12, 2023 at 08:42 AM
Expires on September 11, 2024 at 08:42 AM (4 months from now)

Schedule (PowerShell)

$URL = Read-Host "URL을 입력해주세요"

$WebClient = New-Object System.Net.WebClient
$WebClient.Encoding = [System.Text.Encoding]::UTF8

$Html = $WebClient.DownloadString($URL)
$Html -match "ytInitialPlayerResponse = (.+?);</script>" | Out-Null
$jsonString = $Matches[1]
$metadataObject = ConvertFrom-Json $jsonString

# $author = $metadataObject.videoDetails.author
$title = $metadataObject.videoDetails.title
$unixTimestamp = $metadataObject.playabilityStatus.liveStreamability.liveStreamabilityRenderer.offlineSlate.liveStreamOfflineSlateRenderer.scheduledStartTime
$localTime =  (Get-Date 01.01.1970).AddSeconds($unixTimestamp).ToLocalTime()

Write-Host "제목: $title"
Write-Host "시작시간: $localTime"

# 한글 영어 일본어 숫자만 허용
$invalidCharsRegex = '[^a-zA-Z0-9가-힣ぁ-んァ-ヶ一-龯 ]'
$validTaskName = $title -replace $invalidCharsRegex, "_"

## 스케줄러 등록 변수
# Task Name
$tn = "\My works\OpenYoutube\$validTaskName"
# Task Run
## 기본 브라우저로 실행
$tr = "powershell -Command 'Start-Process -FilePath $URL'"
## 특정 브라우저로 실행 Browser 경로를 입력
# $browser = "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
# $tr = "'$browser' '$URL'"

# 실행시간 (1분전에 실행)
$sdt = $localTime.AddMinutes(-1)
# Start Time
$sd = $sdt.ToString("yyyy-MM-dd")
$st = $sdt.ToString("HH:mm:ss")

schtasks /create /sc "ONCE" /tn $tn /tr $tr /sd $sd /st $st

Read-Host "종료를 위해 엔터키를 입력해주세요"