Gaston's - Video/Image Downloader

Instagram/Youtube/tiktok Video/Audio Downloader alwayts updated

当前为 2024-07-31 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Gaston's - Video/Image Downloader
  3. // @namespace http://tampermonkey.net/
  4. // @version 3.8
  5. // @description Instagram/Youtube/tiktok Video/Audio Downloader alwayts updated
  6. // @author gaston1799
  7. // @match *://www.youtube.com/*
  8. // @match *://www.instagram.com/*
  9. // @match *://music.youtube.com/*
  10. // @match *://y2mate.nu/*
  11. // @match *://onlymp3.app/*
  12. // @match *://snapsave.io/*
  13. // @match *://onlymp3.to/*
  14. // @match *://fastdl.app/*
  15. // @match *://en.onlymp3.app/*
  16. // @match *://studio.youtube.com/*
  17. // @match *://www.yt2conv.com/*
  18. // @match *://soundcloud.com/*
  19. // @match *://sclouddownloader.net/*
  20. // @match *://www.tiktok.com/*
  21. // @match *://en3.onlinevideoconverter.pro/*
  22. // @match *://savetik.co/*
  23. // @match *://yt5s.biz/*
  24. // @match *://sss.instasaverpro.com/*
  25. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  26. // @require https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js
  27. // @grant GM_info
  28. // @grant GM_xmlhttpRequest
  29. // @grant GM_getValue
  30. // @grant GM_setValue
  31. // @grant GM_deleteValue
  32. // @grant GM_addValueChangeListener
  33. // @grant GM_removeValueChangeListener
  34. // @license MIT
  35. // ==/UserScript==
  36.  
  37. //YT: https://www.youtube.com/channel/UCOA8lE9-0XnEIdHqjfQUz1A
  38. var adev, set_, CurrentPlayingSymbol = "▶";
  39.  
  40. function getV(e, t) {
  41. return GM_getValue(e) || (GM_setValue(e, t), t)
  42. }
  43.  
  44. function setV(e, t) {
  45. GM_setValue(e, t)
  46. }
  47.  
  48. function getCurrentVideoID() {
  49. var e;
  50. return [...document.getElementsByClassName("ytp-video-menu-item ytp-button")].forEach(((t, n) => {
  51. t.innerText.startsWith(CurrentPlayingSymbol) && (e = new URL(t.href).searchParams.get("v"))
  52. })), !e && document.getElementsByClassName("ytp-playlist-menu-button ytp-button")[0] ? (console.log("Opening"), document.getElementsByClassName("ytp-playlist-menu-button ytp-button")[0].click(), getCurrentVideoID()) : e ? (console.log("Closiung"), document.getElementsByClassName("ytp-playlist-menu-button ytp-button")[0].click(), e) : console.warn("Not Found!")
  53. }
  54.  
  55. function sleep(e) {
  56. return new Promise((t => setTimeout(t, e)))
  57. }
  58. _getV = getV, _setV = setV, Number.prototype.decimal = function(e) {
  59. return Number(this.toFixed(e))
  60. }, getSoundCloudUrl = () => {
  61. try {
  62. return findhref2(document.querySelector("#app > div.playControls.g-z-index-control-bar.m-visible > section > div > div.playControls__elements > div.playControls__soundBadge.sc-ml-3x > div"))[0].href
  63. } catch {
  64. return
  65. }
  66. }, async function() {
  67. async function e(e, t = 3e4) {
  68. var n;
  69. for (sleep(t).then((e => n = !0)); !document.querySelector(e) && (await sleep(0), !n););
  70. return document.querySelector(e)
  71. }
  72. return location.href.includes("/embed/") ? (console.log("Attaching to embeder >:]"), e(".ytp-right-controls").then((async e => {
  73. let t = new _e("button", {
  74. id: "embedMP3"
  75. }).appendTo(e).set("innerText", "MP3").on("click", (function() {
  76. let e = getCurrentVideoID() || setElement(location.href);
  77. downloadT(e, !1, !0, !1, !0)
  78. }));
  79. for (; !document.getElementById("embedMP3") && document.querySelector(".ytp-right-controls");) console.log("Appended"), t.appendTo(".ytp-right-controls")
  80. }))) : (document.querySelector(".ytp-right-controls"), await e(".playbackSoundBadge__actions", 5e3).then((async t => {
  81. let n = new _e("button", {
  82. id: "GetAudio"
  83. }).appendTo(t).set("innerText", "Download MP3").on("click", (function() {
  84. downloadSC()
  85. }), (e => e));
  86. for (;;) !document.getElementById("GetAudio") && await e(".playbackSoundBadge__actions", 5e3) && await e(".playbackSoundBadge__actions", 5e3).then((e => {
  87. n.appendTo(e), console.log("Added Button")
  88. })), await sleep(0)
  89. })))
  90. }().then(console.log, console.warn), downloadSC = function() {
  91. GM_setValue("SCinfo", null), GM_setValue("sc", getSoundCloudUrl()), !set_ && (set_ = 1, GM_addValueChangeListener("SCinfo", (function(e, t, n, o) {
  92. n && n.name && downloadFileAsTitle(n.href, n.name)
  93. }))), open("https://sclouddownloader.net/")
  94. }, GM_setValue_ = GM_setValue, GM_getValue_ = GM_getValue, GM_info_ = GM_info;
  95. var UnmutePath = "M3.15,3.85l4.17,4.17L6.16,9H3v6h3.16L12,19.93v-7.22l2.45,2.45c-0.15,0.07-0.3,0.13-0.45,0.18v1.04 c0.43-0.1,0.83-0.27,1.2-0.48l1.81,1.81c-0.88,0.62-1.9,1.04-3.01,1.2v1.01c1.39-0.17,2.66-0.71,3.73-1.49l2.42,2.42l0.71-0.71 l-17-17L3.15,3.85z M11,11.71v6.07L6.52,14H4v-4h2.52l1.5-1.27L11,11.71z M10.33,6.79L9.62,6.08L12,4.07v4.39l-1-1V6.22L10.33,6.79 z M14,8.66V7.62c2,0.46,3.5,2.24,3.5,4.38c0,0.58-0.13,1.13-0.33,1.64l-0.79-0.79c0.07-0.27,0.12-0.55,0.12-0.85 C16.5,10.42,15.44,9.1,14,8.66z M14,5.08V4.07c3.95,0.49,7,3.85,7,7.93c0,1.56-0.46,3.01-1.23,4.24l-0.73-0.73 C19.65,14.48,20,13.28,20,12C20,8.48,17.39,5.57,14,5.08z",
  96. mutePath = "M17.5,12c0,2.14-1.5,3.92-3.5,4.38v-1.04c1.44-0.43,2.5-1.76,2.5-3.34c0-1.58-1.06-2.9-2.5-3.34V7.62 C16,8.08,17.5,9.86,17.5,12z M12,4.07v15.86L6.16,15H3V9h3.16L12,4.07z M11,6.22L6.52,10H4v4h2.52L11,17.78V6.22z M21,12 c0,4.08-3.05,7.44-7,7.93v-1.01c3.39-0.49,6-3.4,6-6.92s-2.61-6.43-6-6.92V4.07C17.95,4.56,21,7.92,21,12z";
  97.  
  98. function downloadFile_(e, t) {
  99. const n = document.createElement("a");
  100. n.href = e, n.download = t, document.body.appendChild(n), n.click(), document.body.removeChild(n)
  101. }
  102. downloadFileAsTitle = function(e, t, n, o) {
  103. const l = document.createElement("a");
  104. return l.style.display = "none", document.body.appendChild(l), fetch(e).then((e => e.blob())).then((i => {
  105. const r = URL.createObjectURL(i);
  106. l.href = r, l.download = t, l.target = "_blank", l.click(), URL.revokeObjectURL(r), (n || opener || window).postMessage({
  107. url: e,
  108. title: t,
  109. s: !0
  110. }, "*"), (typeof o).includes("function") && o()
  111. })).catch((o => {
  112. console.error("Error downloading file:", o), (n || opener || window).postMessage({
  113. url: e,
  114. title: t,
  115. s: !1
  116. }, "*")
  117. }))
  118. }, query = function(e) {
  119. return t = $(e) ? $(e).length ? $(e)[0] : $(e) : null, Object.keys(t).length ? t : null;
  120. var t
  121. }, getElementByAttribute = function(e, t = "aria-label", n = document.body) {
  122. var o = [];
  123. return function n(l) {
  124. l.getAttribute(t) == e ? o.push(l) : l.children.length && ((l = l.children).forEach = [].forEach, l.forEach((e => {
  125. n(e)
  126. })))
  127. }(n), 1 == o.length ? o[0] : o || !1
  128. }, get_aria_label = function(e, t = document.body) {
  129. var n = [];
  130. return function t(o) {
  131. o.getAttribute("aria-label") == e ? n.push(o) : o.children.length && ((o = o.children).forEach = [].forEach, o.forEach((e => {
  132. t(e)
  133. })))
  134. }(t), n[0] || !1
  135. }, getClass = function(e) {
  136. return document.getElementsByClassName("ehlq8k34")[0]
  137. },
  138. function() {
  139. class e {
  140. static get br() {
  141. return new e("br")
  142. }
  143. constructor(e, t) {
  144. this.element = e.constructor.name.includes("HTML") && e || function() {
  145. for (let e in arguments[1]) arguments[0].setAttribute(e, arguments[1][e]);
  146. return arguments[0]
  147. }(document.createElement(arguments[0]), arguments[1])
  148. }
  149. style(e) {
  150. for (let t in e) this.element.style[t] = e[t];
  151. return this
  152. }
  153. append(e, ...t) {
  154. this.element.append(e.element || e), console.log("T:", {
  155. targets: t,
  156. fe: t && t.forEach
  157. });
  158. for (let e = 0; e < t.length; e++) {
  159. let n = t[e];
  160. console.log("Appending:", {
  161. element: n,
  162. target: this
  163. }), this.element.append(n.element || n)
  164. }
  165. return this
  166. }
  167. appendTo(e) {
  168. return (e.element || "string" == typeof e ? document.querySelector(e) : e).append(this.element), this
  169. }
  170. on(e, t) {
  171. return this.element[`on${e}`] = t, this
  172. }
  173. set(e, t) {
  174. return this.element[e] = t, this
  175. }
  176. remove() {
  177. return this.element.remove(), this
  178. }
  179. get() {
  180. return this.element[arguments[0]]
  181. }
  182. get children() {
  183. return new class {
  184. constructor(e) {
  185. for (var t = 0; t < e.length; t += 1) this[t] = e[t];
  186. Object.defineProperty(this, "length", {
  187. get: function() {
  188. return e.length
  189. }
  190. }), Object.freeze(this)
  191. }
  192. item(e) {
  193. return null != this[e] ? this[e] : null
  194. }
  195. namedItem(e) {
  196. for (var t = 0; t < this.length; t += 1)
  197. if (this[t].id === e || this[t].name === e) return this[t];
  198. return null
  199. }
  200. get toArray() {
  201. return [...this]
  202. }
  203. }([...this.element.children])
  204. }
  205. }
  206. _e = e, setElement2 = function(e) {
  207. return e.match(/(?<host>https?\:\/\/www\.tiktok\.com)\/(?<username>@[^\/]+)\/video\/(?<videoID>\d+)/i).groups
  208. };
  209. var t, n, o = "https://onlymp3.app";
  210.  
  211. function l(e) {
  212. "function" == typeof jQuery && e instanceof jQuery && (e = e[0]);
  213. var t = e.getBoundingClientRect();
  214. return t.top >= 0 - (window.innerHeight || document.documentElement.clientHeight) / 2 && t.left >= 0 && t.bottom <= (window.innerHeight || document.documentElement.clientHeight) + (window.innerHeight || document.documentElement.clientHeight) / 2 && t.right <= (window.innerWidth || document.documentElement.clientWidth)
  215. }
  216.  
  217. function i(e, {
  218. callback: t,
  219. int: n
  220. }) {
  221. !t && (t = function() {}), !n && (n = 100), console.log({
  222. f: e,
  223. callback: t,
  224. int: n
  225. });
  226. try {
  227. return e(), void t()
  228. } catch (e) {}
  229. var o = setInterval((() => {
  230. try {
  231. e(), t(), clearInterval(o)
  232. } catch (e) {}
  233. }), n || 100);
  234. return o
  235. }
  236.  
  237. function r(e) {
  238. return null === e.offsetParent
  239. }
  240.  
  241. function c(e) {
  242. return e.parentNode
  243. }
  244.  
  245. function a() {
  246. return get_aria_label("Go back") && get_aria_label("Go back").click ? get_aria_label("Go back") : document.querySelector("._afxv")
  247. }
  248.  
  249. function s() {
  250. return get_aria_label("Next") && get_aria_label("Next").click ? get_aria_label("Next") : document.querySelector("._afxw")
  251. }
  252.  
  253. function u() {
  254. if (location.href.includes("reel")) {
  255. let t = open("https://fastdl.app/en", location.href, "width=400,height=500");
  256. var e = GM_addValueChangeListener("instaURL", (function(n, o, l, i) {
  257. l && (console.log("Got", {
  258. a: n,
  259. b: o,
  260. c: l,
  261. d: i
  262. }), t.close(), GM_removeValueChangeListener(e), downloadFile_(l, document.title + ".mp4"), GM_setValue("instaURL", null))
  263. }))
  264. }
  265. }
  266.  
  267. function d() {
  268. (async function() {
  269. for (var e = e => new Promise((t => setTimeout(t, e))), t = new Set, n = {}; a();) {
  270. if (await e(100), !a()) {
  271. await e(1e3);
  272. break
  273. }
  274. a().click()
  275. }[...getInstalImages()].forEach((e => {
  276. let n = findhref2(e, "img")[0];
  277. t.add([n.src, n.getAttribute("alt")])
  278. })), s().click();
  279. try {
  280. s().click()
  281. } catch (e) {}
  282. for (; s();) {
  283. await e(300), [...getInstalImages()].forEach((e => {
  284. let n = findhref2(e, "img")[0];
  285. t.add([n.src, n.getAttribute("alt")])
  286. }));
  287. try {
  288. s().click()
  289. } catch (e) {}
  290. }
  291. for (; await e(100), a();) a().click();
  292. [...t].forEach((e => {
  293. n[e[0]] = e[1]
  294. })), (t = Object.keys(n).map((e => ({
  295. src: e,
  296. name: n[e]
  297. })))).forEach((e => {
  298. var t = new URL(e.src).pathname.split(".").pop();
  299. downloadFileAsTitle(e.src, `${e.name}.${t}`)
  300. })), console.log("done", t)
  301. })().then(console.log, console.warn)
  302. }
  303. if (setElement = function(e) {
  304. return !(!String(e).match(/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?)|(shorts\/))\??v?=?([^#\&\?]*).*/) || 11 != String(e).match(/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?)|(shorts\/))\??v?=?([^#\&\?]*).*/)[8].length) && String(e).match(/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?)|(shorts\/))\??v?=?([^#\&\?]*).*/)[8]
  305. }, findhref2 = function(e, t) {
  306. var n = [];
  307. return function e(o) {
  308. o.tagName.toLowerCase() == (t || "a") ? (n.push(o), o.children.length && ((o = o.children).forEach = [].forEach, o.forEach((t => {
  309. e(t)
  310. })))) : o.children.length && ((o = o.children).forEach = [].forEach, o.forEach((t => {
  311. e(t)
  312. })))
  313. }(e), n
  314. }, getInstalImages = function() {
  315. return document.querySelectorAll("._acaz")
  316. }, getInstaVideo = function() {
  317. return document.querySelector("video.x1lliihq")
  318. }, downloadVideoFromBlob = function(e, t) {
  319. if (e && e.src && e.src.startsWith("blob:")) {
  320. const n = e.captureStream(),
  321. o = new MediaRecorder(n),
  322. l = [];
  323. o.ondataavailable = e => {
  324. e.data.size > 0 && (l.push(e.data), console.log(e.data))
  325. }, o.onstop = () => {
  326. const e = new Blob(l, {
  327. type: "video/mp4"
  328. }),
  329. n = URL.createObjectURL(e),
  330. o = document.createElement("a");
  331. o.style.display = "none", o.href = n, o.download = t + ".mp4", document.body.appendChild(o), o.click(), document.body.removeChild(o), URL.revokeObjectURL(n)
  332. }, o.start(), setTimeout((() => {
  333. o.stop()
  334. }), 1e3 * e.duration)
  335. } else console.error("Invalid video element or source.")
  336. }, "fastdl.app" == document.domain) onload = async function() {
  337. const e = {
  338. url: name,
  339. input: null
  340. };
  341. var t = !1;
  342. const n = e => new Promise((t => setTimeout(t, e)));
  343. var o, l;
  344. for (setTimeout((() => {
  345. t = !0
  346. }), 2e4); !document.querySelector("#search-form-input");)
  347. if (await n(0), t) throw "Cant find input";
  348. e.input = document.querySelector("#search-form-input"), console.log("Found a"), o = e.input, l = e.url, ["focus", "input", "change", "blur"].forEach((e => {
  349. let t = new Event(e, {
  350. bubbles: !0,
  351. isTrusted: !0
  352. });
  353. o[`on${e}`] && o[`on${e}`](t), "input" === e && (o.value = l), o.dispatchEvent(t)
  354. })), document.querySelector(".search-form__button").click(), GM_setValue("instaURL", await async function(e) {
  355. for (; !document.querySelector(e);) await n(0);
  356. return document.querySelector(e)
  357. }(".button--filled").then((e => e.href)))
  358. };
  359. else {
  360. if ("soundcloud.com" == document.domain) return void(getSoundCloadI = function() {
  361. _setV("SC", getSoundCloudUrl()), open("https://sclouddownloader.net/", "SC").onclose = function(e) {
  362. console.log("Win closed")
  363. }
  364. });
  365. if ("studio.youtube.com" == document.domain) return void setInterval((() => {
  366. var e;
  367. try {
  368. [...[...document.querySelectorAll("#video-list")].map((e => [e, [...e.classList]])).filter((e => e[1].includes("ytcp-video-section")))[0][0].children[1].children].map((e => [e, [...e.classList], e.tagName])).filter((e => "YTCP-VIDEO-ROW" == e[2])).filter((e => "Public" == e[0].children[0].querySelectorAll(".cell-body.tablecell-visibility.style-scope.ytcp-video-row")[0].innerText)).map((e => e[0].children[0].querySelectorAll(".cell-body.tablecell-visibility.style-scope.ytcp-video-row")[0])).forEach((e => {
  369. console.log(e), e.append(new _e("br").element);
  370. var t = new _e("button").set("innerText", "Get").on("click", (function() {
  371. alert("Doesnt work yet")
  372. }));
  373. e.append(t.element)
  374. })), e = !0
  375. } catch {
  376. e = !1
  377. }
  378. t != e && (t = e, console.log("Change?", e ? "Found" : "Not FOund"))
  379. }), 0);
  380. if ("www.instagram.com" == document.domain) {
  381. function m() {
  382. console.log("Appended buttons man");
  383. var t = new e(document.querySelectorAll(".xh8yej3.x1iyjqo2")[0]),
  384. n = new e("button", {
  385. id: "MediaButton"
  386. }).set("innerText", "Get Images").on("click", d),
  387. o = new e("button", {
  388. id: "MediaButton2"
  389. }).set("innerText", "Get Videos").on("click", u);
  390. t.append(n, o)
  391. }
  392. return i((function() {
  393. document.querySelectorAll(".xh8yej3.x1iyjqo2")[0].children
  394. }), {
  395. callback: function() {
  396. m(), setInterval((() => {
  397. document.querySelector("#MediaButton") || m(), document.querySelector("._aaqy") && !document.querySelector("._aaqy").querySelector("#MediaButton") && function() {
  398. var t = new e(document.querySelector("._aaqy")),
  399. n = new e("button", {
  400. id: "MediaButton"
  401. }).set("innerText", "Get Images").on("click", d),
  402. o = new e("button", {
  403. id: "MediaButton2"
  404. }).set("innerText", "Get Videos").on("click", u);
  405. t.append(n, o)
  406. }()
  407. }))
  408. }
  409. }), void console.log("Insta ballz")
  410. }
  411. if ("sclouddownloader.net" == document.domain)(async function() {
  412. var e = _getV("SC");
  413. async function t(e, t) {
  414. let n = e => new Promise((t => setTimeout(t, e)));
  415. return await new Promise((async(o, l) => {
  416. var i = !1;
  417. setTimeout((() => (i = 0, l())), t);
  418. for (; !document.querySelector(e);)
  419. if (await n(), i) {
  420. l();
  421. break
  422. }
  423. return o()
  424. })).then((e => !0), (e => !1))
  425. }
  426. if ("/download-sound-track" == location.pathname) {
  427. for (await t("#trackTitle"); !trackTitle.innerText.length;) await sleep(0);
  428. for (await t("#trackLink"); !trackLink.href.length;) await sleep(0);
  429. _setV("SCinfo", {
  430. name: trackTitle.innerText,
  431. href: trackLink.href
  432. }), close()
  433. } else {
  434. if (!_getV("SC")) throw "Bruv";
  435. var n = "#urlInput";
  436. if (await t(n, 2e3), await t(n, 2e3)) {
  437. for (document.querySelector(n).value = e, console.log("EZ url", !!window.formSubmit);
  438. "undefined" == typeof formSubmit;) try {
  439. await sleep(0), console.log("EZ url", formSubmit)
  440. } catch {}
  441. console.log("EZ url", formSubmit), formSubmit(), console.warn("Got"), setInterval(formSubmit, 1e3)
  442. }
  443. }
  444. })().then(console.log, console.warn);
  445. else {
  446. if ("y2mate.nu" == document.domain) {
  447. async function h(e, t = 5e3) {
  448. let n = !1;
  449. for (setTimeout((() => {
  450. console.log("TimeOut for", e), n = !0
  451. }), t); !document.querySelector(e) && (console.log("_", e, n), await sleep(500), !n););
  452. if (console.log(e, n), n) throw "NotFound";
  453. return document.querySelector(e)
  454. }
  455. return id_ = new URL(location.href).searchParams.get("v"), IsShort = 1 == new URL(location.href).searchParams.get("s"), void async function() {
  456. for (;
  457. "complete" != document.readyState;) await sleep(0);
  458. if (id_) {
  459. let e = async e => {
  460. console.log("a", e);
  461. var t = findhref2(document.forms[0])[0].href,
  462. n = findhref2(document.forms[0], "div")[0].innerText,
  463. o = {
  464. id: id_,
  465. href: t,
  466. title: n,
  467. length: {}
  468. };
  469. console.log("Posted"), (opener || window).postMessage(o, "*"), close()
  470. };
  471. try {
  472. await h("#url").then((e => {
  473. console.log("e", e), e.value = IsShort ? `https://www.youtube.com/watch?v=${id_}` : `https://www.youtube.com/shorts/${id_}`, e.parentElement.children[1].click()
  474. })).catch(e), console.log("after url"), await h("#progress").then((async e => {
  475. for (; document.querySelector(`#${e.id}`);) await sleep(0);
  476. console.log("a_")
  477. })).catch(e), console.log("b")
  478. } catch (e) {
  479. console.warn("Error:", e)
  480. }
  481. } else console.warn("No id Found")
  482. }().then(console.log, console.warn)
  483. }
  484. if ("snapsave.io" == document.domain) {
  485. async function h(e, t = 5e3) {
  486. let n = !1;
  487. for (setTimeout((() => {
  488. console.log("TimeOut for", e), n = !0
  489. }), t); !document.querySelector(e) && (console.log("_", e, n), await sleep(500), !n););
  490. if (console.log(e, n), n) throw "NotFound";
  491. return document.querySelector(e)
  492. }
  493. return _wfs = h, void async function() {
  494. var e = await h("#s_input");
  495. if (e) {
  496. console.log("Converting"), id_ = new URL(location.href).searchParams.get("v"), e.value = `https://www.youtube.com/watch?v=${id_}`, ksearchvideo();
  497. var t = await h("#formatSelect");
  498. await h("#btn-action");
  499. t.selectedIndex = 0, t.options[0].selected = !0;
  500. for (var n = await h("#asuccess"); !(n = await h("#asuccess"));) await sleep(0);
  501. for (convertFile(0);
  502. "#" == n.getAttribute("href");) await sleep(0), n = await h("#asuccess");
  503. console.log(n.href);
  504. var o = (await _wfs(".clearfix")).querySelector("h3").innerText,
  505. l = {
  506. id: id_,
  507. href: n.href,
  508. title: o,
  509. length: {}
  510. };
  511. console.log("Posted"), (opener || window).postMessage(l, "*"), close()
  512. } else alert("Input was not Found"), console.warn("?!!")
  513. }().then(console.log).catch(console.warn)
  514. }
  515. }
  516. }
  517.  
  518. function f(e, t = "aria-label", n = document.body) {
  519. var o = [];
  520. return function n(l) {
  521. var i = !1;
  522. t ? l.getAttribute(t) == e && (o.push(l), i = 1) : [...l.attributes].map((e => {
  523. const {
  524. name: t,
  525. value: n
  526. } = e;
  527. return {
  528. name: t,
  529. value: n
  530. }
  531. })).filter((t => t.value == e)).length && (o.push(l), i = 1), l.children.length && !i && ((l = l.children).forEach = [].forEach, l.forEach((e => {
  532. n(e)
  533. })))
  534. }(n), o.length ? 1 == o.length ? o[0] : o || !1 : null
  535. }
  536.  
  537. function p() {
  538. (f("Mute", "title") && f("Mute", "title")[0] || f("Mute (m)", "title")).click()
  539. }
  540.  
  541. function g() {
  542. (query("#right-controls") && query("#right-controls").querySelectorAll("path")[0].getAttribute("d") == UnmutePath && f("Mute", "title")[0] || f("Unmute", "title") || f("Unmute (m)", "title")).click()
  543. }
  544. _getIds = function() {
  545. if (document.domain.includes("music")) throw alert("These button dont work on youtube music yet"), ".";
  546. var e = [...document.getElementsByTagName("ytd-playlist-panel-renderer")].filter(l).filter((e => !r(e)))[0];
  547. return findhref2(e, "span").filter((e => !r(e))).filter(l).filter((e => "video-title" == e.id)).map(c).map(c).map((e => ({
  548. id: setElement(findhref2(c(e))[0].href),
  549. e: e
  550. })))
  551. }, info = {}, downloadT = function(e, t = !1, n = !0, l = !1, i = !1) {
  552. let r = e + (l ? "mp4" : "mp3") + n;
  553. if (localStorage[r] && !t && (!i || !confirm(`You have already download this video as .${l?"mp4":"mp3"}\nStill download?`))) return;
  554. var c = new URL(location.href);
  555. c.host = c.host.replace(".com", "mz.com"), console.log("o", c);
  556. let a = ["https://y2mate.nu/Pio1/", "?v=", e, "&s=", c.pathname.startsWith("/shorts/") ? 1 : 0];
  557. console.log(a);
  558. return function(e, t, n = !1) {
  559. var o = addEventListener(e, ((...e) => {
  560. t(...e), n && removeEventListener(o)
  561. }), !0)
  562. }("unload", (function() {
  563. info[e].close()
  564. }), !0), onmessage = function(e) {
  565. if (e.origin == o || e.origin.match(/https?:\/{2}onlymp3\.to/) || e.origin.match(/https?:\/{2}en\.onlymp3\.to/) || e.origin.match(/https?:\/{2}en(\d)\.onlinevideoconverter\.pro/) || "https://sss.instasaverpro.com" == e.origin || "https://y2mate.nu" == e.origin || "https://snapsave.io" == e.origin) {
  566. const {
  567. data: {
  568. href: o,
  569. title: l,
  570. length: i,
  571. id: c
  572. }
  573. } = e;
  574. if (console.log("Handled", {
  575. href: o,
  576. title: l,
  577. length: i,
  578. id: c
  579. }, e), n) {
  580. var t = document.createElement("a");
  581. t.download = l + ".mp4", t.href = o, document.body.appendChild(t), t.click(), t.remove()
  582. } else open(o);
  583. localStorage[r] = o
  584. } else console.log("Unhandled Post", e)
  585. }, info[e] = l ? open(location.pathname.startsWith("/shorts/") ? "https://yt5s.biz/enxj100/" : `https://snapsave.io/en42/youtube-mp4?v=${e}`, [e, location.pathname.startsWith("/shorts/") ? 1 : 0, l + !1], "width=400,height=500") : open(a.join(""), [e, location.pathname.startsWith("/shorts/") ? 1 : 0], "width=400,height=500")
  586. }, downloadTikTok = function(e, t) {
  587. (async function(e, t) {
  588. await async function() {
  589. for (; n && !n.closed;) await sleep(0);
  590. return 1
  591. }(), console.log("ez");
  592. let l = t.videoID,
  593. i = t.username,
  594. r = function() {
  595. try {
  596. return document.querySelector("#app > div.css-14dcx2q-DivBodyContainer.e1irlpdw0 > div:nth-child(4) > div > div.css-1qjw4dg-DivContentContainer.e1mecfx00 > div.css-1stfops-DivCommentContainer.ekjxngi0 > div > div.css-1xlna7p-DivProfileWrapper.ekjxngi4 > div.css-1u3jkat-DivDescriptionContentWrapper.e1mecfx011 > div.css-1nst91u-DivMainContent.e1mecfx01 > div.css-bs495z-DivWrapper.e1mzilcj0 > div > div.css-1d7krfw-DivOverflowContainer.e1mzilcj5 > h1").innerText.replace("Replying to ", "")
  597. } catch {
  598. try {
  599. return document.querySelector("#app > div.css-14dcx2q-DivBodyContainer.e1irlpdw0 > div:nth-child(4) > div > div.css-1qjw4dg-DivContentContainer.e1mecfx00 > div.css-1stfops-DivCommentContainer.ekjxngi0 > div > div.css-1xlna7p-DivProfileWrapper.ekjxngi4 > div.css-1u3jkat-DivDescriptionContentWrapper.e1mecfx011 > div.css-1nst91u-DivMainContent.e1mecfx01 > div.css-bs495z-DivWrapper.e1mzilcj0").innerText.replace("Replying to ", "")
  600. } catch (e) {
  601. return f("browse-video-desc", "data-e2e") ? f("browse-video-desc", "data-e2e").innerText : document.querySelector("#main-content-video_detail > div > div.css-12kupwv-DivContentContainer.ege8lhx2 > div.css-1senhbu-DivLeftContainer.ege8lhx3 > div.css-1sb4dwc-DivPlayerContainer.eqrezik4 > div.css-3lfoqn-DivDescriptionContentWrapper-StyledDetailContentWrapper.eqrezik15 > div.css-r4nwrj-DivVideoInfoContainer.eqrezik3 > div.css-bs495z-DivWrapper.e1mzilcj0 > div > h1").innerText.replace("Replying to ", "")
  602. }
  603. }
  604. }();
  605. onmessage = function(e) {
  606. if (e.origin == o || e.origin.match(/https?:\/{2}savetik\.csavetik.coo/) || e.origin.match(/https?:\/{2}en\.onlymp3\.to/) || e.origin.match(/https?:\/{2}en(\d)\.onlinevideoconverter\.pro/) || "https://savetik.co" == e.origin) {
  607. var {
  608. data: {
  609. href: t,
  610. links: l,
  611. title: i,
  612. length: c,
  613. id: a,
  614. mp4: s,
  615. info: {
  616. username: u
  617. }
  618. }
  619. } = e;
  620. if (console.log("Handled", {
  621. href: t,
  622. title: i,
  623. length: c,
  624. id: a,
  625. links: l,
  626. mp4: s
  627. }, e), "https://savetik.co" == e.origin) i = r, downloadFileAsTitle(s ? l[0] : l.pop(), u + " - " + i + (s ? ".mp4" : ".mp3"), n);
  628. else {
  629. if (useT) {
  630. let e = document.createElement("a");
  631. e.download = i + ".mp3", e.href = t, document.body.appendChild(e), e.click(), e.remove()
  632. } else open(t);
  633. localStorage[_] = t
  634. }
  635. } else console.log("Unhandled Post", e)
  636. }, n = open("https://savetik.co/en", [`https://www.tiktok.com/${i}/video/${l}`, e + !1], "width=400,height=500")
  637. })(e, t).then(console.log, console.warn)
  638. }, abc_ = f, M = p, Um = g;
  639. var w = 0;
  640.  
  641. function y(e) {
  642. return !!e && !e.closed
  643. }
  644. async function v(e = [
  645. ["w1", "win1"],
  646. ["w2", "win2"],
  647. ["w3", "win3"],
  648. ["w4", "win4"]
  649. ]) {
  650. var t, n = !1;
  651. return await new Promise(((o, l) => {
  652. var i = setInterval((l => {
  653. e.forEach((e => {
  654. this[e[0]] = y(window[e[1]]), window[e[1]] || n || (n = !0, t = e[1], console.log(e))
  655. })), t && (o(t), clearInterval(i))
  656. }), 500)
  657. })), t
  658. }
  659. window.ch3 = y, window.getWin = v, WIP_ = function(e, t, n) {
  660. var o = _getIds(),
  661. l = [];
  662. for (let t = 0; t < e; t++) l.push(["w" + t, "win" + t]);
  663. o.forEach((({
  664. id: e
  665. }, o) => {
  666. v(l).then((l => {
  667. if (!info[e] && !localStorage[e] || n) {
  668. console.log("download", e, o), window[l] = downloadT(e, n, !0, !!t), window.addEventListener("unload", (function(e) {
  669. window[l].close()
  670. }));
  671. var i = setInterval((e => {
  672. window[l] && !window[l].closed || (window[l] = null, clearInterval(i), console.log(l, "isclosed"))
  673. }), 300)
  674. }
  675. }))
  676. }))
  677. };
  678. var b = new e("button").set("innerText", "Get MP3").on("click", (function(e) {
  679. downloadT(setElement(location.href), !0, !0, !1, !0)
  680. })),
  681. k = new e("button").set("innerText", "Get MP4").on("click", (function(e) {
  682. downloadT(setElement(location.href), !0, !0, !0, !0)
  683. })),
  684. S = new e("button").set("innerText", "PlayList MP3").on("click", (function(e) {
  685. WIP_(2, !1, !1)
  686. })),
  687. T = new e("button").set("innerText", "PlayList MP4").on("click", (function(e) {
  688. WIP_(2, !0, !1)
  689. })),
  690. E = new e("button").set("innerText", "Get MP4").on("click", (function(e) {
  691. downloadTikTok(!0, setElement2(getClass("ehlq8k34") ? getClass("ehlq8k34").innerText : location.href))
  692. })).style({
  693. color: "white"
  694. }),
  695. C = (new e("button", {
  696. id: "tt1"
  697. }).set("innerText", "Get MP4").on("click", (function(e) {
  698. downloadTikTok(!0, setElement2(getClass("ehlq8k34") ? getClass("ehlq8k34").innerText : location.href))
  699. })).style({
  700. color: "white"
  701. }), new e("button").set("innerText", "Get MP3").on("click", (function(e) {
  702. downloadTikTok(!1, setElement2(getClass("ehlq8k34") ? getClass("ehlq8k34").innerText : location.href))
  703. })).style({
  704. color: "white"
  705. }));
  706.  
  707. function q() {
  708. return query("#end") || query("#right-content")
  709. }
  710.  
  711. function x() {
  712. const t = q();
  713.  
  714. function n() {
  715. try {
  716. return !(![...document.querySelectorAll("#header-description")].filter(l).filter((e => !r(e)))[0] && !query(".autoplay")) && ([...document.querySelectorAll("#header-description")].filter(l).filter((e => !r(e)))[0] || query(".autoplay"))
  717. } catch (e) {
  718. return !1
  719. }
  720. }
  721. b.appendTo(t), k.appendTo(t), console.log("Posted Buttons");
  722. var o = !1;
  723. setInterval((() => {
  724. o != n() && n() ? (console.log("Added playlist buttons"), setTimeout((() => {
  725. n().append(e.br.element), n().append(S.element), n().append(T.element)
  726. }), 100)) : o == n() || n() || console.log("buttons are gone?!?!"), o = n()
  727. }), 100)
  728. }
  729. if (a1 = [
  730. ["youtube", function() {
  731. i((function() {
  732. if (!q()) throw "Cant append buttons yet";
  733. return !0
  734. }), {
  735. callback: x
  736. })
  737. }],
  738. ["tiktok", function() {
  739. addEventListener("load", (function() {
  740. i((function() {
  741. if (!abc_("browse-copy", "data-e2e")) throw "Cant Append";
  742. E.appendTo(document.querySelectorAll(".e1mecfx011")), C.appendTo(document.querySelectorAll(".e1mecfx011"))
  743. }), {
  744. callback: function() {}
  745. }), i((function() {
  746. if (!document.getElementsByClassName("e13wiwn60")[0]) throw "Cant Append";
  747.  
  748. function t() {
  749. try {
  750. return !!abc_("browse-copy", "data-e2e").parentNode && abc_("browse-copy", "data-e2e").parentNode
  751. } catch (e) {
  752. return !1
  753. }
  754. }
  755. E.appendTo(document.getElementsByClassName("e13wiwn60")[0]), C.appendTo(document.getElementsByClassName("e13wiwn60")[0]), console.log("Posted Buttons");
  756. var n = !1;
  757. setInterval((() => {
  758. n != t() && t() ? (console.log("Added playlist buttons"), setTimeout((() => {
  759. t().append(e.br.element), t().append(E.element), t().append(C.element)
  760. }), 100)) : n == t() || t() || console.log("buttons are gone?!?!"), n = t()
  761. }), 100)
  762. }), {
  763. callback: function() {}
  764. })
  765. }))
  766. }]
  767. ].filter((e => location.host.includes(e[0])))[0], a1 && a1[1] && a1[1](), delete a1, location.href.includes("onlymp3.app") || location.href.includes("onlymp3.to")) {
  768. console.log("onlymp3.app");
  769. return setInterval((() => {
  770. document.getElementById("error-text").innerText.length > 5 && location.reload()
  771. }), 2e4), console.log("Getting MP3"), void i((function(e = function() {}) {
  772. ! function() {
  773. var [e, t] = name.split(",");
  774. txtUrl.value = `https://www.youtube.com/${"1"==t?"shorts/":"watch?v="}${e}`, getListFormats()
  775. }(), i((function(e = function() {}) {
  776. ! function() {
  777. var e = videoTitle.innerText.split("\n"),
  778. t = e.map((e => e.match(/[:\d]+/gi))).filter((e => !!e)).pop().pop(),
  779. n = e[0].split("Title: ")[1],
  780. o = findhref2(videoTitle.parentNode)[0].href,
  781. l = {
  782. id: setElement(location.href),
  783. href: o,
  784. title: n,
  785. length: t
  786. };
  787. (opener || window).postMessage(l, "*"), console.log("Poasted")
  788. }()
  789. }), {
  790. callback: close
  791. })
  792. }), {
  793. callback: function() {}
  794. })
  795. }
  796. if (location.href.includes("www.yt2conv.com")) {
  797. console.log("Getting MP4");
  798. let [L, A] = name.split(",");
  799. i((function(e = function() {}) {
  800. document.getElementById("search_txt").value = `https://www.youtube.com/${"1"==A?"shorts/":"watch?v="}${L}`, document.getElementById("btn-submit").click(), console.log(L, A)
  801. }), {
  802. callback: function() {}
  803. }), i((function(e = function() {}) {
  804. if (console.log(result.children.length), !result.children.length) throw document.getElementById("btn-submit").click(), "no there"
  805. }), {
  806. int: 1e3,
  807. callback: function() {}
  808. }), i((function() {
  809. document.getElementById("btn-download").click()
  810. }), {
  811. callback: function() {}
  812. }), i((function() {
  813. var e = $(".media-heading")[0].innerText,
  814. t = downloadbtn.href,
  815. n = {
  816. id: L,
  817. href: t,
  818. title: e,
  819. length: {}
  820. };
  821. console.log("Posted"), (opener || window).postMessage(n, "*")
  822. }), {
  823. callback: close
  824. })
  825. }
  826. if (location.href.includes("yt5s.biz")) {
  827. async function h(e) {
  828. for (; !document.querySelector(e);) await sleep(0);
  829. return !0
  830. }(async function() {
  831. let [e, t] = name.split(",");
  832. if (!e.length || !t.length) return console.warn("No info Preset");
  833. var n = `https://www.youtube.com/${"1"==t?"shorts/":"watch?v="}${e}`;
  834. await h("#txt-url"), console.log("Input Loaded"), document.querySelector("#txt-url").value = n, await h("#btn-submit"), console.log("GEtting res"), await sleep(100), document.querySelector("#btn-submit").click(), await h("#video_title"), console.log("Got Res");
  835. var o = document.querySelector("#video_title").innerText,
  836. l = [0];
  837. return [...document.querySelector("#result").querySelector("table").querySelectorAll("tr")].forEach((e => {
  838. var t = e.innerText.match(/(?<res>\d+)(p|P)/i) || {};
  839. t.groups && (t = Number(t.groups.res), l[0] < t && (l[0] = t, l[1] = findhref2(e)[0].href, l[2] = e))
  840. })), {
  841. id: e,
  842. title: o,
  843. href: l[1],
  844. mp4: !0,
  845. res: l[0]
  846. }
  847. })().then((function(e) {
  848. (opener || window).postMessage(e, "*"), location.href = e.href
  849. }), console.warn)
  850. }
  851. if (location.href.includes("sss.instasaverpro.com") && async function() {
  852. for (await async function(e) {
  853. for (; !document.querySelector(e);) await sleep(0);
  854. return !0
  855. }("#A_downloadUrl"); !document.querySelector("#A_downloadUrl").href.length;) await sleep(0);
  856. console.log("Done");
  857. var e = document.querySelector("#myModalLabel").innerText,
  858. t = {
  859. href: document.querySelector("#A_downloadUrl").href,
  860. title: e
  861. };
  862. (opener || window).postMessage(t, "*")
  863. }().then(close, console.warn), location.href.includes("en3.onlinevideoconverter.pro")) {
  864. let [B, V] = name.split(",");
  865. if (!B.length || !V.length) return console.Warn("NO info Preset");
  866. let N = function() {};
  867. i((function(e = function() {}) {
  868. document.getElementById("texturl").value = `https://www.youtube.com/${"1"==V?"shorts/":"watch?v="}${B}`, document.getElementById("convert1").click(), console.log("Searched")
  869. }), {
  870. callback: N
  871. }), i((function() {
  872. if ("none" == stepProcess.style.display) throw document.getElementById("convert1").click(), "this";
  873. console.log("Searching")
  874. }), {
  875. callback: N
  876. }), i((function() {
  877. if (0 == document.getElementById("form-app-root").children.length) throw "";
  878. console.log("loaded");
  879. var {
  880. title: e,
  881. href: t
  882. } = $("#download-720-MP4") && $("#download-720-MP4")[0] ? $("#download-720-MP4")[0] : $("#download-720-MP4"), n = {
  883. id: B,
  884. href: t,
  885. title: e,
  886. length: {}
  887. };
  888. console.log("Posted"), (opener || window).postMessage(n, "*")
  889. }), {
  890. callback: close
  891. })
  892. }
  893. if (location.href.includes("savetik.co")) {
  894. var [P, I] = name.split(",");
  895. addEventListener("load", (function() {
  896. i((function() {
  897. s_input.value = P, ksearchvideo(), setTimeout(ksearchvideo, 1e3)
  898. }), {
  899. callback() {}
  900. })
  901. })), i((function() {
  902. document.getElementsByClassName("clearfix")[0].innerText,
  903. function() {
  904. console.log("Found");
  905. let e = {
  906. title: document.getElementsByClassName("clearfix")[0].innerText,
  907. links: findhref2(document.getElementsByClassName("tik-video")[0]).map((e => e.href)),
  908. mp4: 1 == I,
  909. info: setElement2(P)
  910. };
  911. onmessage = function(e) {
  912. if ("https://www.tiktok.com" == e.origin) {
  913. var {
  914. data: {
  915. s: t,
  916. url: n,
  917. title: o
  918. }
  919. } = e;
  920. console.log("Handled", {
  921. s: t,
  922. url: n,
  923. title: o
  924. }, e), t ? setTimeout(close, 100) : downloadFileAsTitle(n, o, null, close)
  925. } else console.log("Unhandled Post", e)
  926. }, (opener || window).postMessage(e, "*")
  927. }()
  928. }), {
  929. callback() {}
  930. })
  931. }
  932. document.domain.includes("music") && (console.log("Added MiniPlayer Toggle with I"), addEventListener("keypress", (function({
  933. isTrusted: e,
  934. ctrlKey: t,
  935. shiftKey: n,
  936. code: o,
  937. target: l,
  938. target: {
  939. tagName: i
  940. }
  941. }) {
  942. ["INPUT", "TEXTAREA"].includes(i) || t || n || !e || "KeyI" != o || (abc_("Close player page") || abc_("Open player page")[1]).click()
  943. }))), setInterval((e => {
  944. document.getElementsByClassName("ytp-ad-button-icon")[0] && !w && (console.log("muted ad"), w = 1, p()), !document.getElementsByClassName("ytp-ad-button-icon")[0] && w && (console.log("unmuted video"), function() {
  945. try {
  946. g()
  947. } catch (e) {
  948. console.warn("Failed unmuting")
  949. }
  950. }(), w = 0), [...document.querySelectorAll("#song-video"), ...document.querySelectorAll("#ytd-player")].map((e => [...e.querySelectorAll("button")].filter((e => e.className.includes("skip")))[0])).filter((e => !!e))[0] && ([...document.querySelectorAll("#song-video"), ...document.querySelectorAll("#ytd-player")].map((e => [...e.querySelectorAll("button")].filter((e => e.className.includes("skip")))[0])).filter((e => !!e))[0].click(), console.log("Skipped d :>")), document.getElementsByClassName("ytp-ad-overlay-close-button")[2] && (document.getElementsByClassName("ytp-ad-overlay-close-button")[2].click(), console.log("Close ad card"))
  951. }), 10)
  952. }();