mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-29 17:37:54 +01:00
add setState, processResponse to state.js, getVideoId to utils.js
This commit is contained in:
1 parent
d51a5a58b0
commit
689b0b7f8c
3 files changed
+51
-47
No files matched your search
@@ -39,6 +39,16 @@ function getBrowser() {
|
||||
}
|
||||
}
|
||||
|
||||
function getVideoId(url) {
|
||||
const urlObject = new URL(url);
|
||||
const pathname = urlObject.pathname;
|
||||
if (pathname.startsWith("/clip")) {
|
||||
return document.querySelector("meta[itemprop='videoId']").content;
|
||||
} else {
|
||||
return urlObject.searchParams.get("v");
|
||||
}
|
||||
}
|
||||
|
||||
function cLog(message, writer) {
|
||||
message = `[return youtube dislike]: ${message}`;
|
||||
if (writer) {
|
||||
@@ -48,4 +58,4 @@ function cLog(message, writer) {
|
||||
}
|
||||
}
|
||||
|
||||
export { numberFormat, getBrowser, cLog }
|
||||
export { numberFormat, getBrowser, getVideoId, cLog }
|
||||
Reference in new issue
Block a user