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 1547116a..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",
@@ -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": [
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
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);