Created
January 12, 2020 11:44
-
-
Save yaegaki/76a586f24c5093a7cd5d26e990990ea0 to your computer and use it in GitHub Desktop.
Youtubeのアーカイブから開始時間を調べるスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(async () => { | |
const f = await fetch(location.href); | |
const html = await f.text(); | |
const index = html.indexOf('"startTimestamp'); | |
if (index < 0) { | |
console.log('not found startTimestamp'); | |
return; | |
} | |
const count = html.indexOf(',', index) - index; | |
return JSON.parse(`{${html.substr(index, count)}}`.replace(/\\/g,'')).startTimestamp; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment