Fork me on GitHub
Its the Code garbage collector. Mind dumps of daily coding antics from a frustrated silly little man. VBS, PHP, TCL, TK, PERL, C++, JAVA....what now? Ruby?
No Wait.. It should be just RUBY!

20070212

del.icio.us Regex

I was working on bring in my collection of bookmarks for use on del.icio.us. There is still some work to be done on del.icio.us web interface, and most of the API apps that I used just didnt fit the bill so some quick regex helped with importation and exportation.

Main use for this was to enable sharing on all imported bookmarks.

So we need some regex for implementations on the api.

del.icio.us can read and export Netscape bookmark files.

<meta equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Bookmarks</title>
<h1>Bookmarks</h1>
<dl><p>
</p><dt><a href="http://www.testtest.com/" last_visit="117002438" add_date="117002438" tags="wee,w00t">test test</a>
</dt></dl>

These can very easily be modified via regex to work as api calls
Example API calls
https://api.del.icio.us/v1/posts/add?&url=http://www.testtest.com/&description=test test&tags=wee%20w00t&replace=yes&shared=yes
https://api.del.icio.us/v1/posts/delete?&url=http://www.testtest.com/


Regex Convertion for del.icio.us
(<dt><a href="http://www2.blogger.com/%29%28.*%29%28" tags=")(.*)(">)(.*)(</a></dt>)
https://api.del.icio.us/v1/posts/add?&url=\2&description=\6&tags=\4&replace=yes&shared=yes

No comments: