Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- javascript:(function(){
- function getDescriptionBBCode(){
- const container=document.querySelector('div[data-e2e="browse-video-desc"]');
- if(!container) return 'N/A';
- let parts=[];
- container.childNodes.forEach(node=>{
- if(node.nodeType===Node.TEXT_NODE){
- parts.push(node.textContent.trim());
- }else if(node.nodeType===Node.ELEMENT_NODE){
- if(node.matches('span[data-e2e="new-desc-span"]')){
- parts.push(node.textContent.trim());
- }else if(node.matches('a[data-e2e="search-common-link"]')){
- parts.push('[u][url='+node.href+']'+node.textContent.trim()+'[/url][/u]');
- }
- }
- });
- return parts.join(' ').replace(/\s+/g,' ').trim();
- }
- function getText(sel){const el=document.querySelector(sel);return el?el.textContent.trim():'N/A';}
- function getCreatorUrl(){const el=document.querySelector('a[data-e2e="browse-user-avatar"]');return el?el.href:window.location.href;}
- function copy(t){const ta=document.createElement('textarea');ta.value=t;document.body.appendChild(ta);ta.select();document.execCommand('copy');document.body.removeChild(ta);}
- 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);}
- function process(){
- const metadata={
- description:getDescriptionBBCode(),
- creator:getText('span[data-e2e="browse-username"]'),
- creatorUrl:getCreatorUrl(),
- likes:getText('strong[data-e2e="like-count"]'),
- comments:getText('strong[data-e2e="comment-count"]'),
- shares:getText('strong[data-e2e="share-count"]')
- };
- const url=window.location.href;
- 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;
- copy(bb);toast('TikTok data copied');
- }
- if(window.location.hostname==='www.tiktok.com'){
- const button=document.createElement('button');
- button.textContent='Copy TikTok Data';
- Object.assign(button.style,{position:'fixed',top:'10px',left:'10px',padding:'10px 20px',backgroundColor:'#007BFF',color:'white',border:'none',borderRadius:'4px',cursor:'pointer',zIndex:10000});
- button.addEventListener('click',process);
- document.body.appendChild(button);
- }else{alert('Please use this bookmarklet on a TikTok video page');}
- })();
Advertisement
Add Comment
Please, Sign In to add comment