Guest User

Untitled

a guest
Aug 24th, 2025
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. javascript:(function(){
  2.     function getDescriptionBBCode(){
  3.         const container=document.querySelector('div[data-e2e="browse-video-desc"]');
  4.         if(!container) return 'N/A';
  5.         let parts=[];
  6.         container.childNodes.forEach(node=>{
  7.             if(node.nodeType===Node.TEXT_NODE){
  8.                 parts.push(node.textContent.trim());
  9.             }else if(node.nodeType===Node.ELEMENT_NODE){
  10.                 if(node.matches('span[data-e2e="new-desc-span"]')){
  11.                     parts.push(node.textContent.trim());
  12.                 }else if(node.matches('a[data-e2e="search-common-link"]')){
  13.                     parts.push('[u][url='+node.href+']'+node.textContent.trim()+'[/url][/u]');
  14.                 }
  15.             }
  16.         });
  17.         return parts.join(' ').replace(/\s+/g,' ').trim();
  18.     }
  19.     function getText(sel){const el=document.querySelector(sel);return el?el.textContent.trim():'N/A';}
  20.     function getCreatorUrl(){const el=document.querySelector('a[data-e2e="browse-user-avatar"]');return el?el.href:window.location.href;}
  21.     function copy(t){const ta=document.createElement('textarea');ta.value=t;document.body.appendChild(ta);ta.select();document.execCommand('copy');document.body.removeChild(ta);}
  22.     function toast(m){const d=document.createElement('div');Object.assign(d.style,{position:'fixed',top:'10px',right:'10px',padding:'12px 24px',backgroundColor:'#00C851',color:'white',borderRadius:'4px',fontSize:'14px',zIndex:10000,boxShadow:'0 2px 5px rgba(0,0,0,0.2)'});d.textContent=m;document.body.appendChild(d);setTimeout(()=>d.remove(),3000);}
  23.     if(window.location.hostname==='www.tiktok.com'){
  24.         const metadata={
  25.             description:getDescriptionBBCode(),
  26.             creator:getText('span[data-e2e="browse-username"]'),
  27.             creatorUrl:getCreatorUrl(),
  28.             likes:getText('strong[data-e2e="like-count"]'),
  29.             comments:getText('strong[data-e2e="comment-count"]'),
  30.             shares:getText('strong[data-e2e="share-count"]')
  31.         };
  32.         const url=window.location.href;
  33.         const bb='[b]'+metadata.description+'[/b]\n\n[url='+url+']'+url+'[/url]\n\n[b]Creator Info[/b]\n[u][url='+metadata.creatorUrl+']'+metadata.creator+'[/url][/u]\n\n[b]Engagement[/b]\nLikes: '+metadata.likes+'\nComments: '+metadata.comments+'\nShares: '+metadata.shares;
  34.         copy(bb);toast('TikTok data copied');
  35.     }else{alert('Please use this bookmarklet on a TikTok video page');}
  36. })();
  37.  
Advertisement
Add Comment
Please, Sign In to add comment