How to bulk delete bookmarks from delicious
At work we recently decided to clean out most of the tags and a few old posts from the ribot delicious account. I couldn’t find any nice tools that enabled this (if you know of one, do please let me know – this method is a bit of a hack). On the delicious site the only method is to manually delete each tag, when you have over 400 the four clicks it takes to do this just don’t make much sense.
The method I’m going to explain to you, in summary, is this:
- you will copy your bookmarks down to a local mySQL database using an existing open source tool
- you will delete and edit them locally using your preferred tool
- using a script I have made you will turn the database into an uploadable delicious export file
- in your delicious account you will delete all your bookmarks and then import them again from the newly created, cleaned, file
WARNING: this could go wrong, I accept no responsibility for any loss of data, read through before beginning and take a backup of all your bookmarks.
Before you start
- Ensure you have a local apache server with PHP and MySQL installed and enabled. On OS X you will simply need to activate your installation, on windows you can follow my instructions on installing WAMP
- Locate a database editing tool, and it should be one that allows you to delete multiple rows at once such as Navicat
- Create a local database called ‘delicious’ and ensure there is a user that can access it – it could be the default user root if you haven’t changed anything since installing
Getting your bookmarks into the database
Download the mysqlicious tool
Unzip the downloaded file and open the mirror.php file
Find the first block of code and enter your database name (delicious) and the user and password as shown:
[code lang="php"] $MySQL_Host = "localhost"; $MySQL_Database = "delicious"; $MySQL_Table = "delicious"; $MySQL_Username = "root"; $MySQL_Password = ""; [/code]
Then add your delicious username and password to the fields underneath. I found the tag option didn’t work for me, but the idea is you can restrict the export by tag.
Create a folder called delicious in the area where your webserver is set up to point to (this might be your Sites folder on OS X, instructions on the pages listed earlier).
Copy the two files, mirror.php and MySQLicious.php into this folder.
Go to http://localhost/delicious/mirror.php, the tool should now export all your bookmarks to the database.
Modify the database
If you have a good tool, you can now go through the database table named delicious and quickly delete all the posts you no longer need.
A hint – by writing simple database queries you can easily boil your bookmarks down to certain tags – the following SQL will help you:
[code lang="sql"] select * from delicious where tags LIKE '%ajax%' order by tags [/code]
Delete all current bookmarks
WARNING! This could go wrong – ensure you have exported the bookmarks to a file as a backup first. Also please note that any bookmarks you import have to be all set to private, or all set to public – the previous public and private settings will be lost. This problem goes for any kind of import, either the method I am describing here, or by importing the exported file I just reminded you to save.
If you are ready, do the following to quickly delete all your bookmarks:
Go to your bookmarks and set the number displayed to 100
Copy and paste the following code into your browser address bar, replacing the site address
[code lang="javascript"]
javascript:var delay=2;
var s=document.createElement('script'); s.type='text/javascript';
s.src='http://ghill.customer.netspace.net.au/re-mark/re-mark-del-code.js';
document.getElementsByTagName('head')[0].appendChild(s);
void(0);
[/code]
(courtesy of Scripted Remark – Batch Editor For Bookmarks)
Allow a few minutes for this to complete, then select the next button and repeat until all bookmarks are gone.
Upload the bookmarks
Download the delicious-import.php script I put together (right click on that link) and add it to the delicious folder. This file creates a bookmarks html file which can be imported into delicious, or any other browser.
Navigate to http://localhost/delicious/delicious-import.php, save the outputted file somewhere, such as the Desktop (in Firefox go to File -> Save Page As…) and make sure the extension is set to html.
Go to the Manual import settings and import the file you just saved.
Your done!
