2017 © Pedro Peláez
 

library delicious-export

Parser for del.icio.us export files

image

adibaba/delicious-export

Parser for del.icio.us export files

  • Sunday, August 27, 2017
  • by adibaba
  • Repository
  • 1 Watchers
  • 0 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

DeliciousExport

The social bookmarking service Delicious (del.icio.us) was acquired by Pinboard (see blog post) and is in read-only mode now. You can export your delicious bookmarks and save them in a HTML file. This script parses those files., (*1)

Features

  • Backup private bookmarks (or exclude them)
  • Create a structured HTML file
  • Generate JSON file with PHP
  • Split tags which were accidentally separated with whitespaces
  • Include or exclude bookmark notes/descriptions
  • Sort tags by size or name
  • Include bookmarks without tags
  • Specify the format of date/time
  • Adapt templates or extend PHP classes (no private methods)

Examples

Preparation

  • Install PHP.
  • Download the latest DeliciousExport release at GitHub
    Decompress the ZIP-file.
  • Download your bookmarks at del.icio.us/export.
    Copy the downloaded delicious.html into the folder src.
  • Create a file run.php with an example code below and store it in the folder src.
    Open the console (Windows: Press [Win] + [R], enter cmd).
    Navigate to the src directory and enter php run.php.

Create structured HTML bookmarks file

<?php
require_once 'HtmlParser.php';
require_once 'Generator.php';

$parser = new Adibaba\DeliciousExport\HtmlParser('delicious.html');
$parser->parse();

$generator = new Adibaba\DeliciousExport\Generator();
$generator->setHtmlParser($parser);
file_put_contents('bookmarks.html', $generator->generate());
?>

Create JSON bookmarks file

<?php
require_once 'HtmlParser.php';
$parser = new Adibaba\DeliciousExport\HtmlParser('delicious.html');
file_put_contents('bookmarks.json', json_encode($parser->parse()->getBookmarks()));
?>

Option for HTML parser: Split tags

A tag 'php code' will become two tags 'php' and 'code'., (*2)

<?php
require_once 'HtmlParser.php';
$parser = new Adibaba\DeliciousExport\HtmlParser('delicious.html');
$parser->setSplitTags(true);
file_put_contents('bookmarks.json', json_encode($parser->parse()->getBookmarks()));
?>

Options for HTML Generator

The following options are defaults., (*3)

<?php
require_once 'HtmlParser.php';
require_once 'Generator.php';

$parser = new Adibaba\DeliciousExport\HtmlParser('delicious.html');
$parser->parse();

$generator = new Adibaba\DeliciousExport\Generator();
$generator->setHtmlParser($parser)

// Templates
->setTemplateMain('./templateMain.htm')
->setTemplateTag('<li><a href="#_TAG_">_TAG_<span>_TAG_SIZE_</span></a></li>', false)
->setTemplateCollection('<h1 id="_TAG_">_TAG_</h1><ul>_BOOKMARKS_</ul>', false)
->setTemplateBookmark('./templateBookmark.htm')
->setTemplateBookmarkNote('<pre>_BOOKMARK_NOTE_</pre>', false)
->setTemplateBookmarkTag('<span><a href="#_BOOKMARK_TAG_">_BOOKMARK_TAG_</a></span>', false)

// Default tag for bookmarks without specified tag
->setDefaultNoTags('No-Tags')

// Specifies, if bookmark notes/descriptions are added
->setIncludeNotes(true)

// Specifies, if only public bookmarks should be included
->setIncludePrivateBookmarks(true)

// Specifies, if HTML entities should be encoded
->setEncodeHtml(true)

// Sets representation for date/time
->setDateFormat('Y-m-d');

file_put_contents('bookmarks.html', $generator->generate());
?>

Work with PHP objects

<?php
require_once 'HtmlParser.php';
$parser = new Adibaba\DeliciousExport\HtmlParser('delicious.html');
$parser->parse();

// Bookmarks
print_r($parser->getBookmarks());

// Tags, sorted by name
print_r($parser->getTags());

// Tags, sorted by size
print_r($parser->getTags(true));

// Bookmarks without tags
print_r($parser->getBookmarkIdsWithoutTags());
?>

The Versions

27/08 2017

dev-master

9999999-dev

Parser for del.icio.us export files

  Sources   Download

MIT

export backup archive bookmarks delicious del.icio.us

27/08 2017

v1.2.2

1.2.2.0

Parser for del.icio.us export files

  Sources   Download

MIT

export backup archive bookmarks delicious del.icio.us

27/08 2017

v1.2.1

1.2.1.0

Parser for del.icio.us export files

  Sources   Download

MIT

export backup archive bookmarks delicious del.icio.us

26/08 2017

v1.1

1.1.0.0

Parser for del.icio.us export files

  Sources   Download

MIT

export bookmarks delicious del.icio.us

26/08 2017

v1.2

1.2.0.0

Parser for del.icio.us export files

  Sources   Download

MIT

export bookmarks delicious del.icio.us

20/08 2017

v1.0

1.0.0.0

Parser for del.icio.us export files

  Sources   Download

MIT

export bookmarks delicious del.icio.us