Skip to content

Commit 75599dc

Browse files
committed
fix saveme
1 parent 4192924 commit 75599dc

File tree

2 files changed

+29
-123
lines changed

2 files changed

+29
-123
lines changed

scripts/net-request-rules/rules.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,33 @@
180180
]
181181
},
182182
"condition": {
183+
"domain": "extension://*",
183184
"urlFilter": "*://api22-normal-c-useast2a.tiktokv.com/*",
184185
"resourceTypes": ["main_frame", "xmlhttprequest"]
185186
}
187+
},
188+
{
189+
"id": 8,
190+
"priority": 1,
191+
"action": {
192+
"type": "modifyHeaders",
193+
"requestHeaders": [
194+
{
195+
"header": "referer",
196+
"operation": "set",
197+
"value": "https://savevideo.me/en/"
198+
},
199+
{
200+
"header": "origin",
201+
"operation": "set",
202+
"value": "https://savevideo.me"
203+
}
204+
]
205+
},
206+
"condition": {
207+
"domain": "extension://*",
208+
"urlFilter": "https://savevideo.me/*",
209+
"resourceTypes": ["xmlhttprequest"]
210+
}
186211
}
187212
]

scripts/savevideo_me.js

Lines changed: 4 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default {
1414
en: "Download videos from Dailymotion, Facebook, Vimeo, Twitter, Instagram / Reels, TikTok, Rumble.com, Streamable.com, Aol Video, Bilibili.com (哔哩哔哩), Bilibili.tv, Coub, DouYin (抖音), Flickr Videos, Focus.de, GMX.net / WEB.DE, ItemFix, Magisto, Reddit, Sapo.pt, T.me (Telegram), Tiscali.it Video, Tudou, Veoh, Vidmax.com, Vine (archive), WorldStarHipHop, Youku",
1515
vi: "Tải videos từ Dailymotion, Facebook, Vimeo, Twitter, Instagram / Reels, TikTok, Rumble.com, Streamable.com, Aol Video, Bilibili.com (哔哩哔哩), Bilibili.tv, Coub, DouYin (抖音), Flickr Videos, Focus.de, GMX.net / WEB.DE, ItemFix, Magisto, Reddit, Sapo.pt, T.me (Telegram), Tiscali.it Video, Tudou, Veoh, Vidmax.com, Vine (archive), WorldStarHipHop, Youku",
1616
},
17-
17+
1818
onClickExtension: async function () {
1919
// https://savevideo.me/en/
2020

@@ -26,137 +26,18 @@ export default {
2626

2727
let formData = new FormData();
2828
formData.append("url", url);
29-
formData.append("src", base64.encode(`<html></html`));
29+
formData.append("form", "Download");
3030

31-
let res = await fetch("https://savevideo.me/en/", {
31+
let res = await fetch("https://savevideo.me/en/get/", {
3232
method: "POST",
3333
body: formData,
3434
});
3535
let text = await res.text();
36-
console.log(text);
37-
openPopupWithHtml(text);
36+
openPopupWithHtml(text, 600, 400);
3837
} catch (e) {
3938
alert("ERROR: " + e);
4039
} finally {
4140
closeLoading();
4241
}
4342
},
4443
};
45-
46-
function bookmarklet() {
47-
let appPath = "https://savevideo.me/en/";
48-
var form = document.createElement("form");
49-
form.setAttribute("method", "post");
50-
form.setAttribute("action", appPath);
51-
var hidden_field_1 = document.createElement("input");
52-
hidden_field_1.setAttribute("type", "hidden");
53-
hidden_field_1.setAttribute("name", "url");
54-
hidden_field_1.setAttribute("value", document.location);
55-
form.appendChild(hidden_field_1);
56-
var hidden_field_2 = document.createElement("input");
57-
hidden_field_2.setAttribute("type", "hidden");
58-
hidden_field_2.setAttribute("name", "src");
59-
hidden_field_2.setAttribute("value", base64_encode(document.body.innerHTML));
60-
form.appendChild(hidden_field_2);
61-
document.body.appendChild(form);
62-
form.submit();
63-
}
64-
65-
var base64 = {
66-
key_string:
67-
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
68-
encode: function (input) {
69-
var output = "";
70-
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
71-
var i = 0;
72-
input = base64.utf8_encode(input);
73-
while (i < input.length) {
74-
chr1 = input.charCodeAt(i++);
75-
chr2 = input.charCodeAt(i++);
76-
chr3 = input.charCodeAt(i++);
77-
enc1 = chr1 >> 2;
78-
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
79-
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
80-
enc4 = chr3 & 63;
81-
if (isNaN(chr2)) {
82-
enc3 = enc4 = 64;
83-
} else if (isNaN(chr3)) {
84-
enc4 = 64;
85-
}
86-
output =
87-
output +
88-
this.key_string.charAt(enc1) +
89-
this.key_string.charAt(enc2) +
90-
this.key_string.charAt(enc3) +
91-
this.key_string.charAt(enc4);
92-
}
93-
return output;
94-
},
95-
decode: function (input) {
96-
var output = "";
97-
var chr1, chr2, chr3;
98-
var enc1, enc2, enc3, enc4;
99-
var i = 0;
100-
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
101-
while (i < input.length) {
102-
enc1 = this.key_string.indexOf(input.charAt(i++));
103-
enc2 = this.key_string.indexOf(input.charAt(i++));
104-
enc3 = this.key_string.indexOf(input.charAt(i++));
105-
enc4 = this.key_string.indexOf(input.charAt(i++));
106-
chr1 = (enc1 << 2) | (enc2 >> 4);
107-
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
108-
chr3 = ((enc3 & 3) << 6) | enc4;
109-
output = output + String.fromCharCode(chr1);
110-
if (enc3 != 64) {
111-
output = output + String.fromCharCode(chr2);
112-
}
113-
if (enc4 != 64) {
114-
output = output + String.fromCharCode(chr3);
115-
}
116-
}
117-
output = base64.utf8_decode(output);
118-
return output;
119-
},
120-
utf8_encode: function (string) {
121-
string = string.replace(/\r\n/g, "\n");
122-
var utf_string = "";
123-
for (var n = 0; n < string.length; n++) {
124-
var c = string.charCodeAt(n);
125-
if (c < 128) {
126-
utf_string += String.fromCharCode(c);
127-
} else if (c > 127 && c < 2048) {
128-
utf_string += String.fromCharCode((c >> 6) | 192);
129-
utf_string += String.fromCharCode((c & 63) | 128);
130-
} else {
131-
utf_string += String.fromCharCode((c >> 12) | 224);
132-
utf_string += String.fromCharCode(((c >> 6) & 63) | 128);
133-
utf_string += String.fromCharCode((c & 63) | 128);
134-
}
135-
}
136-
return utf_string;
137-
},
138-
utf8_decode: function (utf_string) {
139-
var string = "";
140-
var i = 0;
141-
var c = (c1 = c2 = 0);
142-
while (i < utf_string.length) {
143-
c = utf_string.charCodeAt(i);
144-
if (c < 128) {
145-
string += String.fromCharCode(c);
146-
i++;
147-
} else if (c > 191 && c < 224) {
148-
c2 = utf_string.charCodeAt(i + 1);
149-
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
150-
i += 2;
151-
} else {
152-
c2 = utf_string.charCodeAt(i + 1);
153-
c3 = utf_string.charCodeAt(i + 2);
154-
string += String.fromCharCode(
155-
((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)
156-
);
157-
i += 3;
158-
}
159-
}
160-
return string;
161-
},
162-
};

0 commit comments

Comments
 (0)