Unable to bulk import a list of urls

  • For a Windows path you need to use two backslashes for each backslash (because backslash is an escape character).
  • @dstillman
    That's it! Thank you so much!
  • Hi everyone,

    I'm trying to use the javascript code as well but keep getting the same mistake as above:

    var path = '/Users/bruno/Desktop/articles.txt';
    var urls = Zotero.File.getContents(path).split('\n').map(url => url);
    await Zotero.HTTP.processDocuments(
    async function (doc) {
    var translate = new Zotero.Translate.Web();
    var translators = await translate.getTranslators();
    if (translators.length) {
    try {
    await translate.translate();
    catch (e) {}
    await ZoteroPane.addItemFromDocument(doc);

    [Exception... "Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsIFile.initWithPath]" nsresult: "0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH)" location: "JS frame :: chrome://zotero/content/xpcom/file.js :: Zotero.File</this.getContents :: line 159" data: no]

    What can I do?
  • Sorry, I forgot to say: I used two backslashes as well.
  • I managed to make the code work, but have bumped into another issue: whenever it encounters a broken link it just stops, instead of continuing forward. What should I do?
  • Hello @dstillman,

    I have tried you javascript code for bulk upload from a file of urls.

    It's working, but not as well as I had hoped : it's actually adding snapshots from the url's webpages, while what I want is the whole of the references mentioned on each url's webpages (the zotero connector of each of these page is actually offering a list of references to import) to be imported into zotero.
    Example of one these pages : https://www.idref.fr/026766701.

    Thank you in advance for your help !
  • I tried the initial code that was posted by dstillman and it worked. But if I insert a list of journal article URLs, they will be stored as webpages, not as journal articles. I would need them to be stored as journal articles and, ideally, the abstracts should automatically be downloaded as well. Is it possible to adjust the code in this way somehow?
  • @fprnt: This is all explained in the thread, but as I say, this isn't a supported option and we don't recommend using it, so you're on your own here.
  • Thanks for posting this. I also have the need for bulk import :-) Helping a friend writing his PhD dissertation. He collected a bunch of references as http links and now needs to add hundreds of such items to his formal reference list via zotero.

    As far as I understand and tested the script you posted works by importing everything into the main collection. Is there a way to import the items in the list into a specific collection? He has his references split in several subcollections.

  • @ankanaan: You don't need that. Just sort by Date Added and drag them to the collection.
  • duuuuh.

    thanks very much, that was really easy, problem solved.

Sign In or Register to comment.