diff options
author | Ajay Ramachandran <[email protected]> | 2019-08-10 19:51:08 -0400 |
---|---|---|
committer | Ajay Ramachandran <[email protected]> | 2019-08-10 19:51:08 -0400 |
commit | ccafbf663c0cd3c3800a7fd70ece4b65a39a3cda (patch) | |
tree | 00f61035a9419930e1a8a110f271509a1e520c9d | |
parent | b964d93ea948b94515a7a93dc573c5ab5a52be3c (diff) | |
download | SponsorBlock-ccafbf663c0cd3c3800a7fd70ece4b65a39a3cda.tar.gz SponsorBlock-ccafbf663c0cd3c3800a7fd70ece4b65a39a3cda.zip |
Fixed typos.
Co-author worked on creating this url parser.
Co-Authored-By: Giacomo Rossetto <[email protected]>
-rw-r--r-- | utils.js | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1,13 +1,15 @@ function getYouTubeVideoID(url) { - try { // Attempt to parse url + //Attempt to parse url + try { var obj = new URL(url); } catch (e) { console.error("[SB] Unable to parser URL"); return false } - if(!["www.youtube.com","www.youtube-nocookie.com"].includes(obj.host)) return false // Check if valid hostname + //Check if valid hostname + if(!["www.youtube.com","www.youtube-nocookie.com"].includes(obj.host)) return false; if (obj.pathname == "/watch" && obj.searchParams.has("v")) { id = obj.searchParams.get("v"); // Get ID from searchParam @@ -17,7 +19,7 @@ function getYouTubeVideoID(url) { return obj.pathname.substr(7, 11); } catch (e) { console.error("[SB] Video ID not valid"); - return false + return false; } } } |