smallkan

Untitled

Jan 17th, 2019
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. ! function(t) {
  2. var e = {};
  3.  
  4. function n(o) {
  5. if (e[o]) return e[o].exports;
  6. var r = e[o] = {
  7. i: o,
  8. l: !1,
  9. exports: {}
  10. };
  11. return t[o].call(r.exports, r, r.exports, n), r.l = !0, r.exports
  12. }
  13. n.m = t, n.c = e, n.d = function(t, e, o) {
  14. n.o(t, e) || Object.defineProperty(t, e, {
  15. configurable: !1,
  16. enumerable: !0,
  17. get: o
  18. })
  19. }, n.n = function(t) {
  20. var e = t && t.__esModule ? function() {
  21. return t.default
  22. } : function() {
  23. return t
  24. };
  25. return n.d(e, "a", e), e
  26. }, n.o = function(t, e) {
  27. return Object.prototype.hasOwnProperty.call(t, e)
  28. }, n.p = "", n(n.s = 2)
  29. }({
  30. 2: function(t, e) {
  31. const n = document.body.getElementsByTagName("video")[0];
  32. n.removeAttribute("autoplay"), n.setAttribute("crossorigin", "anonymous"), chrome.runtime.sendMessage({
  33. __ga: !0,
  34. category: "usage",
  35. action: "visit-video",
  36. label: location.href
  37. }), chrome.runtime.sendMessage({
  38. action: "VISIT_CDN",
  39. url: document.location.href
  40. });
  41. const o = t => `https://openload.co/f/${t}`,
  42. r = t => t.match(/ +\w+="[^"]+"/g).filter(t => !!t).reduce((t, e) => {
  43. try {
  44. let [n, o] = e.split("=");
  45. return n = n.trim(), o = o.slice(1, o.length - 2), Object.assign(t, {
  46. [n]: o
  47. })
  48. } catch (e) {
  49. return t
  50. }
  51. }, {});
  52. !async function() {
  53. const t = function() {
  54. try {
  55. const [t, e] = location.href.match(/\/([^/]+)\/[^/]+$/);
  56. return e
  57. } catch (t) {
  58. return null
  59. }
  60. }(),
  61. e = o(t);
  62. console.info("Retrieving video subtitle");
  63. try {
  64. const t = (await window.fetch(e).then(t => t.text())).match(/<track kind="captions"[^>]+\/>/g).map(t => r(t)).filter(t => void 0 !== t.src);
  65. if (0 === t.length) return void console.info("This video have no subtitle");
  66. t.forEach(t => (function(t) {
  67. const e = document.createElement("track");
  68. Object.assign(e, t, {
  69. kind: "captions"
  70. }), n.appendChild(e), e.addEventListener("load", function() {
  71. console.log("track loaded")
  72. })
  73. })(t)), setTimeout(() => n.textTracks[0].mode = "showing", 100)
  74. } catch (t) {
  75. console.info("error while retrieving subtitles", t)
  76. }
  77. }()
  78. }
  79. });
Advertisement
Add Comment
Please, Sign In to add comment