From fce844a28609e787d2ec88a53c764b10dbc2a8cb Mon Sep 17 00:00:00 2001 From: "hoang.tran12" Date: Mon, 8 Apr 2024 15:09:09 +0700 Subject: [PATCH 1/3] fix --- scripts/content-scripts/run_scripts.js | 3 +- scripts/search_userscript.js | 7 +-- scripts/youtube_downloadVideo.js | 6 ++- scripts/zingmp3_downloadMusic.js | 66 +++++++++++++------------- 4 files changed, 43 insertions(+), 39 deletions(-) diff --git a/scripts/content-scripts/run_scripts.js b/scripts/content-scripts/run_scripts.js index 613444aa..be3c9ed6 100644 --- a/scripts/content-scripts/run_scripts.js +++ b/scripts/content-scripts/run_scripts.js @@ -16,7 +16,8 @@ runScripts(ids, detail.event, path); }); - const data = await UsefulScriptGlobalPageContext.Extension.getActiveScripts(); + const data = + await UsefulScriptGlobalPageContext?.Extension?.getActiveScripts?.(); console.log(data); ids = data?.ids?.split(",") || []; path = data?.path || ""; diff --git a/scripts/search_userscript.js b/scripts/search_userscript.js index d9d2f506..bcca9022 100644 --- a/scripts/search_userscript.js +++ b/scripts/search_userscript.js @@ -1,5 +1,5 @@ export default { - icon: "https://www.tampermonkey.net/favicon.ico", + icon: "https://www.userscript.zone/favicon.ico", name: { en: "Search Userscripts", vi: "Tìm Userscripts", @@ -10,9 +10,6 @@ export default { }, onClickExtension: function () { - let search = prompt("Search for Userscripts:", ""); - if (search != null) { - window.open("https://www.userscript.zone/search?q=" + search); - } + window.open("https://www.userscript.zone/"); }, }; diff --git a/scripts/youtube_downloadVideo.js b/scripts/youtube_downloadVideo.js index 7ca13cb1..cebb08ac 100644 --- a/scripts/youtube_downloadVideo.js +++ b/scripts/youtube_downloadVideo.js @@ -19,13 +19,17 @@ export default { } let options = [ + { + name: "y2mate.com", + func: (url) => url.replace("youtube.com", "youtubepp.com"), + }, { name: "yt1s.com", func: (url) => "https://yt1s.com/vi/youtube-to-mp4?q=" + url, }, { name: "yt5s.com", - func: (url) => url.replace("youtube", "youtube5s"), + func: (url) => url.replace("youtube.com", "youtube5s.com"), }, { name: "tubemp3.to", diff --git a/scripts/zingmp3_downloadMusic.js b/scripts/zingmp3_downloadMusic.js index 9d1b7f95..da23c14e 100644 --- a/scripts/zingmp3_downloadMusic.js +++ b/scripts/zingmp3_downloadMusic.js @@ -62,7 +62,7 @@ export default { return sig; }, - requestZing: async ({ path, qs, willHashParam }) => { + requestZing: async ({ path, qs, willHashParam, host = URL_API }) => { let param = new URLSearchParams(qs).toString(); let sig = await Utils.hashParam(path, param, willHashParam); @@ -73,7 +73,7 @@ export default { sig, }; - return URL_API + path + "?" + new URLSearchParams(params).toString(); + return host + path + "?" + new URLSearchParams(params).toString(); }, }; @@ -134,6 +134,19 @@ export default { willHashParam: false, }); }, + async downloadSong(id) { + return await Utils.requestZing({ + host: "https://download.zingmp3.vn", + path: "/api/v2/download/post/song", + qs: { id }, + }); + }, + async getLyric(id) { + return await Utils.requestZing({ + path: "/api/v2/lyric/get/lyric", + qs: { id }, + }); + }, //#endregion //#region other APIs @@ -202,44 +215,33 @@ export default { qs: { page }, }); }, - // async getUserListSong({ - // type = "library", - // page = 1, - // count = 50, - // sectionId = "mFavSong", - // } = {}) { - // return await Utils.requestZing({ - // path: "/api/v2/user/song/get/list", - // qs: { type, page, count, sectionId }, - // // willHashParam: false, - // }); - // }, - // async getSectionPlaylist(id) { - // return await Utils.requestZing({ - // path: "/api/v2/playlist/getSectionBottom", - // qs: { id }, - // }); - // }, - // async getLastPlaying() { - // return await Utils.requestZing({ - // path: "/api/v2/user/lasplaying/get/lasplaying", - // }); - // }, + async getLastPlaying() { + return await Utils.requestZing({ + path: "/api/v2/user/lasplaying/get/lasplaying", + }); + }, //#endregion }; (async function () { - // window.open(await ZingMp3.search("game thủ liên minh")); - // window.open(await ZingMp3.getLastPlaying()); // window.open(await ZingMp3.getHome()); - // window.open(await ZingMp3.getChartHome()); - // window.open(await ZingMp3.getInfoMusic("ZWFE8OUO")); - // window.open(await ZingMp3.getStreaming("Z6WZD78I")); + // window.open(await ZingMp3.getLyric("ZZDEZ8UC")); + // window.open(await ZingMp3.getInfoMusic("ZZDEZ8UC")); + // window.open(await ZingMp3.getStreaming("ZZDEZ8UC")); + // window.open(await ZingMp3.search("game thủ liên minh")); + // window.open(await ZingMp3.getUserMusicOverview()); + // window.open(await ZingMp3.getDetailPlaylist("Z6CZOIWU")); + // window.open(await ZingMp3.getDetailArtist("ICM")); + + // window.open(await ZingMp3.getChartHome()); // => die + // window.open(await ZingMp3.getLastPlaying()); // => not working? + // window.open(await ZingMp3.downloadSong("Z7ZCD9BD")); // => some songs be blocked on pc + // return; const tab = await getCurrentTab(); - let url = prompt("Nhap link bai hat: ", tab.url); + let url = prompt("Nhập link hoặc id bài hát: ", tab.url); if (url) { - let songid = ZingMp3.getSongIdFromURL(url); + let songid = url.length > 10 ? ZingMp3.getSongIdFromURL(url) : url; if (songid) { try { const streamUrl = await ZingMp3.getStreaming(songid); From 509125cd6ed240b0de74e8deb930d0dd610b5e55 Mon Sep 17 00:00:00 2001 From: "hoang.tran12" Date: Mon, 8 Apr 2024 15:09:21 +0700 Subject: [PATCH 2/3] all_frame --- manifest.json | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index 1547116a..a8ba969f 100644 --- a/manifest.json +++ b/manifest.json @@ -33,7 +33,8 @@ "run_at": "document_start", "world": "ISOLATED", "match_origin_as_fallback": true, - "match_about_blank": true + "match_about_blank": true, + "all_frames": true }, { "matches": [""], @@ -44,7 +45,8 @@ "run_at": "document_start", "world": "MAIN", "match_origin_as_fallback": true, - "match_about_blank": true + "match_about_blank": true, + "all_frames": true }, { "matches": [""], @@ -52,7 +54,8 @@ "run_at": "document_idle", "world": "MAIN", "match_origin_as_fallback": true, - "match_about_blank": true + "match_about_blank": true, + "all_frames": true }, { "matches": [""], @@ -60,7 +63,8 @@ "run_at": "document_end", "world": "MAIN", "match_origin_as_fallback": true, - "match_about_blank": true + "match_about_blank": true, + "all_frames": true } ], "web_accessible_resources": [ From 9db6c7c91a4459f921ec51ab3ffa53a2a31034d2 Mon Sep 17 00:00:00 2001 From: "hoang.tran12" Date: Mon, 8 Apr 2024 15:14:01 +0700 Subject: [PATCH 3/3] new release --- README.md | 2 +- manifest.json | 2 +- md/CHANGELOGS.md | 13 +++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6a10d511..de2c578e 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Donate? Muốn hỗ trợ mình 1 ly cafe <3 [Donate here](https://github.com/Ho ## Lịch sử cập nhật -Verion hiện tại: v1.1 v1.2 v1.3 v1.4 v1.5 v1.6 **v1.64-hotfix** (03/04/2024) +Verion hiện tại: v1.1 v1.2 v1.3 v1.4 v1.5 v1.6 v1.64-hotfix **v1.65-hotfix** (08/04/2024) [Lịch sử cập nhật](/md/CHANGELOGS.md) diff --git a/manifest.json b/manifest.json index a8ba969f..79a1dfb3 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 3, "name": "Useful Scripts", "description": "Scripts that can make your life faster and better", - "version": "1.64", + "version": "1.65", "icons": { "16": "./assets/icon16.png", "32": "./assets/icon32.png", diff --git a/md/CHANGELOGS.md b/md/CHANGELOGS.md index 2930d630..51ca920c 100644 --- a/md/CHANGELOGS.md +++ b/md/CHANGELOGS.md @@ -1,5 +1,18 @@ ## Change logs +
+ v1564-hotfix - 08/04/2024 + + Fix các chức năng tự động chạy + + Optimize scripts autorun + + Bữa 03/04 fix chưa hết :( + + [Tất cả Chức năng](./LIST_SCRIPTS_VI.md) + +
+
v1.64-hotfix - 03/04/2024