Skip to content

Commit ff9ae63

Browse files
added youtu.be support & code style improvements
1 parent a9582df commit ff9ae63

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

scripts/checker.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,17 @@ function change_url_param(key, value) {
5151
}
5252

5353
function autocorrect_url(input_url) {
54-
url = input_url
55-
if ( url.startsWith("youtube.com") ) {
56-
url = "https://www." + url
54+
url = input_url;
55+
if ( url.includes("youtu.be") ) {
56+
url = "https://www.youtube.com/watch?v=" + url.split("/").pop();
57+
} else if ( url.startsWith("youtube.com") ) {
58+
url = "https://www." + url;
5759
} else if ( url.startsWith("www") ) {
58-
url = "https://" + url
60+
url = "https://" + url;
5961
}
6062

6163
if ( url.includes("&t=") ) {
62-
url = url.split("&t=")[0]
64+
url = url.split("&t=")[0];
6365
}
6466

6567
return url
@@ -184,11 +186,7 @@ function get_rating(rating_percent) {
184186
}
185187

186188
for ( rating in ratings ) {
187-
console.log(rating)
188-
console.log(rating_percent)
189-
console.log()
190189
if ( rating_percent < rating ) {
191-
console.log("done!")
192190
return ratings[rating]
193191
} else {
194192
continue

0 commit comments

Comments
 (0)