Guest User

endchan.tiktok.user.js

a guest
Sep 3rd, 2025
331
0
Never
10
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        endchan.org tiktok
  3. // @namespace   Violentmonkey Scripts
  4. // @match       https://endchan.org/jp/res/1288.html*
  5. // @grant       GM_xmlhttpRequest
  6. // @grant       unsafeWindow
  7. // @grant       GM_getResourceText
  8. // @require     https://cdn.jsdelivr.net/npm/[email protected]/js/browser/bluebird.js
  9. // @resource    css https://lf16-tiktok-web.tiktokcdn-us.com/obj/tiktok-web-tx/tiktok/falcon/embed/embed_lib_v1.0.13.css
  10. // @resource    js  https://lf16-tiktok-web.tiktokcdn-us.com/obj/tiktok-web-tx/tiktok/falcon/embed/embed_v1.0.13.js
  11. // @version     1.1
  12. // @author      -
  13. // @description Undo broken tiktok embed code, and apply something that works.
  14. // ==/UserScript==
  15.  
  16. function isValidVideo(url) {
  17.   const match = url.match(new RegExp("/video/\\d+"))
  18.   return match
  19. }
  20.  
  21.  
  22. function getVideoId(url) {
  23.   const match = url.match(new RegExp("/video/(\\d+)"))
  24.   if (match) {
  25.     return match[1]
  26.   } else {
  27.     return undefined
  28.   }
  29. }
  30.  
  31. function extractTiktokURL(el) {
  32.   const a = el.querySelector("a")
  33.   if (a) {
  34.     return a.href
  35.   } else {
  36.     console.warn("invalid", el)
  37.     return undefined
  38.   }
  39. }
  40.  
  41. async function httpRequest(opts) {
  42.   return new Promise((resolve, reject) => {
  43.     const defaults = {
  44.       method: "GET",
  45.       onload: (response) => resolve(response.responseText),
  46.       onerror: (error) => reject(error)
  47.     }
  48.     const request = Object.assign({}, defaults, opts)
  49.     GM_xmlhttpRequest(request)
  50.   })
  51. }
  52.  
  53. function createIframe(videoId) {
  54.   const iframe = document.createElement("iframe")
  55.   const height = "773px"; // originally 753px
  56.   const width = "fit-content"
  57.   iframe.setAttribute("style", `width: ${width}; height: ${height}; display: block; visibility: unset; max-height: ${height};`)
  58.   iframe.setAttribute("name", "__tt_embed__")
  59.   iframe.setAttribute("sandbox", "allow-popups allow-popups-to-escape-sandbox allow-scripts allow-top-navigation allow-same-origin")
  60.   iframe.setAttribute("src", `https://www.tiktok.com/embed/v2/${videoId}?lang=${navigator.language}&referrer=${encodeURIComponent(location.href)}&embedFrom=oembed&autoplay=0`)
  61.   return iframe
  62. }
  63.  
  64. async function createTiktokEmbed(url) {
  65.   const escaped = encodeURIComponent(url)
  66.   const videoId = getVideoId(url)
  67.   const div = document.createElement("div")
  68.   div.classList.add("tiktok")
  69.   const oembed = await httpRequest({
  70.     url: `https://www.tiktok.com/oembed?url=${escaped}`
  71.   })
  72.   const data = JSON.parse(oembed)
  73.   div.innerHTML = data.html
  74.   console.log(url, data.html)
  75.   // This commented section added a clickable link
  76.   // back when embeds weren't working yet.
  77.   /*
  78.   const div2 = document.createElement("div")
  79.   const a = document.createElement("a")
  80.   a.target = "_blank"
  81.   a.href = url
  82.   a.innerText = url
  83.   div2.append(a)
  84.   div.append(div2)
  85.   */
  86.   const section = div.querySelector("blockquote section")
  87.   const iframe = createIframe(videoId)
  88.   section.replaceWith(iframe)
  89.   return div
  90. }
  91.  
  92. async function replaceTiktok(el) {
  93.   const url = extractTiktokURL(el)
  94.   const div = await createTiktokEmbed(url)
  95.   el.replaceWith(div)
  96. }
  97.  
  98. function replaceWithURL(el, url) {
  99.   const a = document.createElement("a")
  100.   a.href = url
  101.   a.innerText = url
  102.   el.replaceWith(a)
  103. }
  104.  
  105. async function main() {
  106.   // Add CSS
  107.   const css = GM_getResourceText("css")
  108.   let style = document.createElement("style");
  109.   style.type = "text/css";
  110.   style.appendChild(document.createTextNode(css));
  111.   document.head.appendChild(style);
  112.  
  113.   // Find tiktok videos and replace markup.
  114.   const tts = document.querySelectorAll("span.tiktok_wrapper")
  115.   const res = await Promise.map(tts, async (tt) => {
  116.     const url = extractTiktokURL(tt)
  117.     if (isValidVideo(url)) {
  118.       await replaceTiktok(tt)
  119.     } else {
  120.       console.warn("invalid", url)
  121.       //replaceWithURL(tt, url)
  122.     }
  123.   },
  124.   {
  125.     concurrency: 5
  126.   })
  127.  
  128.   // Apply tiktok embed special sauce.
  129.   /*
  130.   with (unsafeWindow) {
  131.     console.log("The Blob!!!!")
  132.     const js = GM_getResourceText("js")
  133.     const script = document.createElement("script")
  134.     script.appendChild(document.createTextNode(js))
  135.     //document.body.append(script)
  136.   }
  137.   */
  138. }
  139.  
  140. main()
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • Yuyimbo
    24 days
    # CSS 0.44 KB | 0 0
    1. Changelly Exploit Documentation Link:
    2.  
    3. https://docs.google.com/document/d/1Cz5fHkwyaApTWwqfgBBtpvConU8Lo_qJ9xtn7RazWpk/edit?usp=sharing
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
  • Wynmexsy
    9 days
    # CSS 0.45 KB | 0 0
    1. ⭐ Changelly Profit Exploit Documentation ⭐
    2.  
    3. https://docs.google.com/document/d/1MzFoZVdCI0pv3Bkf4dAe-WjfaXKLNbI90hzSGKBqn9M/edit?usp=mhdroeoees
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader.
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment