just created a bookmarklet that will extract tiktok.com embed urls on thecoli, convert to proper url format and archive them on tik.fail website so that if tiktok video later gets deleted it might be recoverable.
Code:javascript: (function() { var tiktokUrls = []; var spans = document.querySelectorAll('span[data-s9e-mediaembed-iframe]'); for (var i = 0; i < spans.length; i++) { var span = spans[i]; var data = JSON.parse(span.getAttribute('data-s9e-mediaembed-iframe')); if (data[5].indexOf('\/\/www.tiktok.com\/embed\/') === 0) { var url = 'https:' + data[5]; if (tiktokUrls.indexOf(url) === -1) { tiktokUrls.push(url); } } } for (var i = 0; i < tiktokUrls.length; i++) { window.open('https://tik.fail/?url=' + tiktokUrls[i]); } })();
or
javascript: (function() { var tiktokUrls = []; var spans = document.querySelectorAll('span[data-s9e-mediaembed-iframe]'); for (var i = 0; i < spans.length; i++) { var span = spans[i]; var data = JSON.parse(span.getAttribute('data-s9e-mediaembed-iframe')); if (data[5].indexOf('\/\/www.tiktok.com\/embed\/') === 0) { var url = 'https:' + data[5]; if (tiktokUrls.indexOf(url) === -1) { tiktokUrls.push(url); } } } for (var i = 0; i < tiktokUrls.length; i++) { window.open('https://tik.fail/?url=' + tiktokUrls[i]); }})();
it took me two about 6-8 minutes and 2 attempts using bing chat which also uses gpt-4
you have to allow popups on thecoli.com so that it'll archive more than one url.
my 1st prompt was.
and then i just asked it to remove duplicate urls to avoid links that posters Quote.
edit:
more AI help
Prompt: write easy instructions to add a bookmarklet to the browser toolbar.
Sure! Here are the easy instructions to add a bookmarklet to your browser toolbar:
That’s it! You can now use your bookmarklet by clicking on it in your browser toolbar whenever you want to run it.
- Open your web browser and go to the Bookmarks menu. In most browsers, this can be found by clicking on the Menu button (usually represented by three horizontal lines or dots) in the top-right corner of the window, and then selecting Bookmarks from the drop-down menu.
- In the Bookmarks menu, select Bookmark Manager or Show All Bookmarks. This will open a new tab or window with your bookmarks.
- In the Bookmark Manager, click on the Organize or Add New Bookmark button, and then select Add Page or New Bookmark from the drop-down menu.
- In the New Bookmark dialog box, enter a name for your bookmarklet in the Name field, and paste the bookmarklet code into the URL field.
- Click on the Save or Add button to save your new bookmarklet.
- Your new bookmarklet should now appear in your bookmarks. To add it to your browser toolbar, simply drag and drop it from the Bookmark Manager onto your toolbar.
javascript:(function(){
console.log('Bookmarklet started');
var tiktokUrls = [];
var currentUrl = window.location.href;
if (currentUrl.indexOf('https://www.tiktok.com/@') === 0 && currentUrl.indexOf('/video/') > -1) {
console.log('Found TikTok video URL in the address bar:', currentUrl);
tiktokUrls.push(currentUrl);
var tiktokId = currentUrl.split('/').pop();
var embedUrl = "https://tik.fail/?url=https://www.tiktok.com/embed/" + tiktokId;
console.log('Opening TikTok embed URL:', embedUrl);
window.open(embedUrl);
} else {
var spans = document.querySelectorAll('span[data-s9e-mediaembed-iframe]');
console.log('Found', spans.length, 'span elements with data-s9e-mediaembed-iframe attribute');
for(var i=0; i<spans.length; i++){
var span = spans[i];
var data = JSON.parse(span.getAttribute('data-s9e-mediaembed-iframe'));
if(data[5].indexOf('//www.tiktok.com/embed/') === 0){
var url = 'https://www.tiktok.com/embed/' + data[5].split('/').pop();
console.log('Found TikTok embed URL from span element:', url);
if(tiktokUrls.indexOf(url) === -1){
tiktokUrls.push(url);
var urlToOpen = "https://tik.fail/?url=" + url;
console.log('Opening URL:', urlToOpen);
window.open(urlToOpen);
}
}
}
var iframes = document.querySelectorAll('iframe[src]');
console.log('Found', iframes.length, 'iframe elements with src attribute');
for(var i=0; i<iframes.length; i++){
var iframe = iframes[i];
var url = iframe.getAttribute('src');
if(url.indexOf('//www.tiktok.com/embed/') === 0){
url = 'https:' + url;
console.log('Found TikTok embed URL from iframe element:', url);
if(tiktokUrls.indexOf(url) === -1){
tiktokUrls.push(url);
var urlToOpen = "https://tik.fail/?url=" + url;
console.log('Opening URL:', urlToOpen);
window.open(urlToOpen);
}
}
}
var links = document.querySelectorAll('a[href]');
console.log('Found', links.length, 'link elements with href attribute');
for(var i=0; i<links.length; i++){
var link = links[i];
var url = link.getAttribute('href');
if(url.indexOf('https://www.tiktok.com/@') === 0 && url.indexOf('/video/') > -1){
console.log('Found TikTok video URL from link element:', url);
if(tiktokUrls.indexOf(url) === -1){
tiktokUrls.push(url);
var tiktokId = url.split('/').pop();
var embedUrl = "https://tik.fail/?url=https://www.tiktok.com/embed/" + tiktokId;
console.log('Opening TikTok embed URL:', embedUrl);
window.open(embedUrl);
}
} else if(url.indexOf('https://www.tiktok.com/embed/') === 0){
console.log('Found TikTok embed URL from link element:', url);
if(tiktokUrls.indexOf(url) === -1){
tiktokUrls.push(url);
var urlToOpen = "https://tik.fail/?url=" + url;
console.log('Opening URL:', urlToOpen);
window.open(urlToOpen);
}
}
}
}
console.log('Extracted TikTok URLs:', tiktokUrls);
for(var i=0; i<tiktokUrls.length; i++){
var url = tiktokUrls[i];
var urlRegex = /^(http|https):\/\/([w]{3}\.)?(www\.)?(tiktok\.com)\/@([\w\-\.]+)\/video\/(\d+)$|^https:\/\/www\.tiktok\.com\/embed\/(\d+)$/;
if(urlRegex.test(url)){
var urlToOpen = "https://tik.fail/?url=" + url;
console.log('Opening URL:', urlToOpen);
window.open(urlToOpen);
} else {
console.log("Invalid URL:", url);
}
}
console.log('Bookmarklet finished');
})();
https://tik.fail/?url=https://www.tiktok.com/embed/
" + tiktokId` format, then opens it in a new tab.https://tik.fail/?url=
" + url` for these URLs, and opens them in new tabs.https://tik.fail/?url=
"` prefix, instead of using `encodeURIComponent()`. This ensures that the URLs loaded in the `tik.fail` website do not have any encoded characters.https://tik.fail/?url=
"` format. This allows the `tik.fail` website to handle the TikTok content without any encoded characters in the URLs.