Skip to content

Instantly share code, notes, and snippets.

@yaegaki
Created January 12, 2020 11:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yaegaki/76a586f24c5093a7cd5d26e990990ea0 to your computer and use it in GitHub Desktop.
Save yaegaki/76a586f24c5093a7cd5d26e990990ea0 to your computer and use it in GitHub Desktop.
Youtubeのアーカイブから開始時間を調べるスクリプト
(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