Import / Export links in XBEL format
Description of simular project : http://drupal.org/node/62525

Comments

NancyDru’s picture

Project: LinksDB » Web Links
Version: 4.7.x-1.x-dev » 6.x-2.x-dev
Status: Active » Postponed
Issue tags: +Roadmap

I will be providing a conversion function to the Web Links module, for which this would be a great feature. Moving to that queue as a roadmap item.

NancyDru’s picture

Title: Support XBEL » Import / Export links

Changing the title. I agree that an import/export facility would be nice to have. Whether or not XBEL is the correct format is the bigger question. The current state of import/export in Drupal is a problem. Exporting a node, especially a link, is not a big deal, but all the other stuff could be (i.e. things like taxonomy, ratings, and even comments).

rmiddle’s picture

Title: Import / Export links » Import / Export / Backup links

It might make since to have two types of backups. 1 that only works with weblinks and is for backuping up and migrating from site to site and at least 1 that follows something like XBEL and / or other industry standard.

Thanks
Robert

dannz’s picture

Status: Postponed » Active

Hi - it would be great to be able to import and save in CSV format. For my purposes I could then prepare a whole set of links and then quickly import the lot. If so it would be a real nice-to-have if could also set the weight and the group the link should be assigned to.

Another really nice-to-have feature would be ability to import (and possibly export) links as Firefox bookmarks import/export HTML format. You could then quickly find sites which would be useful to include in the weblinks, bookmark the site, choose the folder (group) and give it a title. In firefox you can also add a description (and tags and keywords). If could import and export from FF bookmarks format, it would really make managing weblinks a dream. Also a nicetohave would be including the favicon as an option. Ideally the import-export to FF bookmarks should mean that nothing is lost in the process - get just the same importing from Drupal Weblinks as would importing from Firefox html saved bookmarks.

IMO Firefox bookmarks support would be a killer feature and the various add-ons for firefox would extend functionality in one go - e.g. there are various import export addons - including this one (experimental) which allows importing from Google spreadsheets (which would solve CSV in one go). https://addons.mozilla.org/en-US/firefox/addon/11445. Also there are various tools like Bookmark Buddy which can handle conversions from other formats (e.g. CSV, Opera etc.) which could be used - all that is needed is a way to import-export from Firefox. (and ideally preserve the ordering as per firefox bookmarks - to make it easy to sort/reorder).

BTW - thanks for a really nice module - really well thought out with great features and great to use.

NancyDru’s picture

Status: Active » Postponed

Putting back to postponed unless someone else has the bandwidth to work on this right now.

Your Google spreadsheet link says it is a one-way transfer only. The link that started this idea says it's not for FF3. So obviously some research will be needed.

It is clear that others have a bigger scope envisioned than I did.

NancyDru’s picture

Marked #477898: Support for Node Import as duplicate.

There are essentially two different import/export techniques being talked about now: 1) import/export of entire nodes; 2) import/export as bookmarks.

NancyDru’s picture

Here's some useful links:
Content and User Import and Export Modules - a comparison page.
Content migration, import, and export - a Drupal group to discuss and plan import/export issues, strategies, and modules.

NancyDru’s picture

Is anyone ready to test an OPML export?

NancyDru’s picture

It would seem that export/import/multiple-create is not really so important. This would have been a first step towards doing these things.

juan_g’s picture

I think what happens is that most people don't know what in heaven OPML is, myself included. ;) Well, I've just read it's some kind of XML, but I would really prefer an option to import CSV (good old comma-separated values) into Web Links, like other user above. For example, phpMyAdmin can export MySQL databases to CSV format (not to OPML), and also plain text databases can be converted to CSV with simple scripts and common programs.

To import a couple of resource directories into Drupal sites, I'm considering three possibilities: Web Links, Links Package, or a custom content type. In any of the three cases, I'll add a few CCK fields. Probably I will go with Web Links, if I can do the import.

Until Web Links has an import feature, I'm thinking that a possible workaround for now would be -maybe- the following, in several steps, using Drupal modules:

1.- Export the current directories to CSV, for example with phpMyAdmin, etc.
2.- Import the CSV into Drupal with Node Import or CSV Parser, to a custom content type with CCK fields.
3.- Convert the imported CCK nodes to the weblinks content type with Node Convert, since it seems that Nodetype would be too basic for this task.

Just a possibility to test, I'm not sure if that would work.

NancyDru’s picture

I expected that the OP would know since the request was specifically for XBEL, which is a less-supported format. I tried to code the module with the idea in mind that it could be easily adapted to any of the possible export/import formats, including eventually CSV/Tab-delimited. However, with no takers in so long, I have largely forgotten what I did; certainly, the import function is not complete.

Frankly, I would much rather see another, more generic, export/import solution from some other module, but that doesn't seem forthcoming.

BTW, I have also recently gotten some code that could possibly provide a more Facebook-like method.

JulieR’s picture

In the meantime, I worked around as follows:
1. Import your CSV using node_import - the weblink nodes are created with everything except the url being fine (the urls all end up as "http://");
2. Using SQL, update the url field in the drupal_weblinks table to be the correct url. There are many ways to do this, depending on what you are comfortable with. I put my old links in a table in the database, which let me create a stored procedure at the mysql prompt as follows:

mysql> delimiter //

mysql>
CREATE PROCEDURE fixlinks(start_nid INT, end_nid INT)
BEGIN
  DECLARE this_nid INT DEFAULT start_nid;
  WHILE this_nid <= end_nid DO
     update drupal_weblinks t3 set url=
       (select url from [old_links_table] t1 left join drupal_node t2 on t1.[old_title_field]=t2.title where t2.nid= this_nid) 
       where t3.nid= this_nid;
     SET this_nid = this_nid + 1;
  END WHILE;
END
//

mysql> delimiter ; 
mysql> call fixlinks(min,max);

use select min(nid), max(nid) from drupal_weblinks; to find out what the min and max should be in the call statement above (assuming these are your only links, otherwise you may need to inspect the table to see which nids to change).

Alternatively, if you only have the links in csv, you could use Excel's concatenate function to build an appropriate set of sql update statements, one for each link, out of your data.

NancyDru’s picture

Perhaps, then, a good initial step would be to look at node_import and find a patch to fix the URL field (and probably things like "last click". See #469470: Support for "Web Links"

juan_g’s picture

NancyDru wrote:

Frankly, I would much rather see another, more generic, export/import solution from some other module

The comparison wiki Content and User Import and Export Modules has just been updated, with more modules. Maybe there is an easier solution for the URL field, etc., with one of those import/export modules. Thanks to JulieR for that temporary workaround.

NancyDru’s picture

Thanks for the update.

It would seem that Node Export can only do one node at a time; I think the request here is for multiple node export/import. Certainly, that is what I would like to see.

tamitha’s picture

subscribe

NancyDru’s picture

juan_g’s picture

I'm not sure, does this last commit (#579208: Make fields available to CCK) mean Web Links 6.x-2.x-dev can now work with any import module that handles CCK fields? That would be really great.

About Node Export, I think it's only for Drupal to Drupal import/export. To import from non-Drupal link directories into Web Links, some possibly suitable modules are listed in the Migrating to Drupal handbook: Node Import, CSV Parser, Migrate, Transformations.

NancyDru’s picture

Yes, I am looking at other vehicles as well. It's just that when I found that article, I hoped it would make all of them easier to implement.

hvalentim’s picture

So, there is no way to mass import bookmarks? No matter the format they are in?
Node Import does not recognize the URL field.

EDIT: In the end since both this module and the Links Package were/are supported by Node Import on Drupal 5, I installed a D5 site, imported the links there and then used Node Export to copy them to D6.

NancyDru’s picture

I can't speak to the Links package. To my knowledge, neither of the current maintainers ever supported Node Import on any release. We would like to have some standard import function, but that is something that seems to not exist in a stable form on Drupal yet.