-
Notifications
You must be signed in to change notification settings - Fork 0
/
delicious
executable file
·37 lines (33 loc) · 1.01 KB
/
delicious
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/perl -W
# Read export file from del.icio.us and extract HREF
# Elmar Klausmeier, 30-Aug-2013
use strict;
my ($tags,$add_date,$prev,$out) = ("","","","");
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst);
print "<ol>\n";
while (<>) {
($add_date,$tags) = ("","");
chomp;
s/\s+$//; # rtrim
#print substr($_,4) . "\n" if /^<DT><A HREF=/;
if (/^<DT><A HREF=/) {
s/^<DT>//;
s/<A HREF=/<a href=/;
s/<\/A>$/<\/a>/;
s/ PRIVATE="0"//;
$tags = $1 if (/TAGS="([ÄÖÜäöüßéèùçø \w:\@\/\(\)\#=\-\+\!\.,\'\&]*)"/);
$tags =~ s/,/, /g;
s/ TAGS="[ÄÖÜäöüßéèùçø \w:\@\/\(\)\#=\-\+\!\.,\'\&]*"//;
if (/ ADD_DATE="(\d+)"/) {
$add_date = $1;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
= localtime($add_date);
$add_date = sprintf("%02d-%02d-%04d", $mday,$mon+1,$year+1900);
}
s/ ADD_DATE="\d+"//;
$out = "<li>$_ ($tags), $add_date</li>\n";
print $out if ($out ne $prev);
$prev = $out; # store current output, to later compare with previous
}
}
print "</ol>\n";