Problem/Motivation

I am unable to import feeds from CSV files. When I attempt to import a CSV file I get the error:

Could not retrieve title from feed

I have tried with various files from big to small.

Proposed resolution

None. Awaiting any.

Comments

franz’s picture

Priority: Critical » Normal
Status: Active » Postponed (maintainer needs more info)

I work a lot with CSV files, never seen this error. Can you provide your importer config and your CSV file(s) so we can reproduce?

smiletrl’s picture

When add a new node, whose node type is attached to feeds, title for this node should be provided manually by user.
If there are two records in the csv file, three nodes will be produced, including two nodes automatically created through the csv file and a new node you just manually created. That node manually created should have a title entered by user in the node add page.
Hope this solve your question.

rdeboer’s picture

Version: 7.x-2.0-alpha5 » 7.x-2.x-dev

Yep, mastermindg's original issue from way back in June 2012 is still an issue in the latest dev snapshot (7.x-2.0-alpha7+19-dev).

It's like smiltr says. To reproduce this is simple. Here are the detailed steps

Create a node type that has (some) fields that you want to populate from your .csv file.
Go to Structure >> Feed Importers (admin/structure/feeds) and edit the Node Importer to specify your mappings.
Create your CSV-to-ContentType mappings. Make sure "Title" is mapped to a column in your CSV.
Under the Basic Settings, if we select "Use standalone form" nothing happens when we then visit /import (is this another bug or desired behaviour, i.e. to do nothing and produce no error).

So instead of "Use standalone form" we pick our content type.
If we now go to /import and pic the importer that has the name of our content type, we get redirected to /node/add/ourcontenttype where we're invited to Choose our CSV.

Press Save. Voila! Error: "Could not retrieve title from feed."

Ok, so maybe fill out the Title field as a minimum and press Save. This still doesn't import anything, just creates and saves a node by this content type as you'd expect on the node creation form!

However after saving, in addition to the View and Edit tabs we now have an Import tab. And guess what? You click that and you can start your CSV import on the next page! Hooray!

So, in order to start an import you have to create one dummy node first, just so you get access to that Import tab!
After that you can delete the node.

I hope you don't mind me saying that is not very intuitive.
Can't wait for the UI improvement. Other than that, this module is great!

acpji’s picture

Hi

I have the same problem. Any solution to it?

thanks

franz’s picture

Wait a minute. Why in heavens are you both attaching and creating nodes from the same node type? They are never supposed to be the same, unless you want some crazy circular functionality. Have you read the docs? They should explain how to use both functionalities, and what are they meant for. For Standalone mode, in /import you should have a link to your importer, from which you can import new nodes.

You only need to attach the importer to a node type when you want to have multiple sources for the importer, for example: importing news from several sources. Have a content type named "New source" and another name "News". Attach importer to News source (each node of that type must have a title to identify it), then map imported content to News. Otherwise, use Standalone and you should never need to create a "dummy node".

rdeboer’s picture

@franz, #5

Repeating this phrase from #3:

Under the Basic Settings, if we select "Use standalone form" nothing happens when we then visit /import (is this another bug or desired behaviour, i.e. to do nothing and produce no error).

We were only driven to our "mad" behaviour because normal operation doesn't seem to work...

franz’s picture

StatusFileSize
new60.85 KB
new43.97 KB

Sorry, I never had such "empty" standalone.

I just installed a sandbox 7.x-2.x and the /import shows fine, as you can see on those screenshots.

import.png

import2.png

megachriz’s picture

@RdeBoer, acpji
Have you tried to reproduce the issue on a clean install with only the modules enabled that Feeds needed to function? Test this to clear out the possibility that the issue is caused by a module conflict.
Have you tried to reproduce the issue with one of Drupal's core themes (for example Bartik, Seven)? Test this to clear out the possibility that the importer is hidden with CSS (which is unlikely, cause you do see an importer on /import when the importer is attached to a node type).

Unlikely, but it can it be that you accidentally disabled the importer on the Feeds Importer list page (/admin/structure/feeds)? The importer should be grayed out then.

twistor’s picture

Component: Feeds Import » Code
Status: Postponed (maintainer needs more info) » Fixed

This is pretty simple.

A quick search for "Could not retrieve title from feed" will tell you what's happening.

Basically, Feeds is making the title of the Source node NOT required. It's trying to be clever and get the title from the feed. CSV files do not have a title, so it is giving you this error. Simply put in the title on your node edit page.

twistor’s picture

Status: Fixed » Needs review
StatusFileSize
new493 bytes

Actually, we should show the standard error message about a required title. That would make things less confusing.

twistor’s picture

Issue summary: View changes
Status: Needs review » Needs work

I changed my mind on this.

What we should do is add a method parsers, something like, hasTitle(), so that we can know if a title is even possible.

dunecat’s picture

@twistor thanks for the insights on the error.
I just solved the problem of "Could not retrieve title from feed".
In my case the cause of it was the replacement of title by title_field everywhere. As I changed titles back to title, it imported content properly.
Would it be possible to integrate this module with title_field module? as it gives much more flexibility over titles especially in multilingual sites. At least in our case.

Thanks for your effort.

socialnicheguru’s picture

I second the feature request

Workaround for now:
https://www.drupal.org/node/1987134#comment-9032005

megachriz’s picture

Title: Could not retrieve title from feed » Could not retrieve title from feed - Make title field only optional if the parser can deliver a title

Changing issue title to make the difference with #2645074: Could not retrieve title from feed - support Title module more clear.

megachriz’s picture

Status: Needs work » Needs review
StatusFileSize
new6.19 KB

This patch adds a method called providesSourceTitle() to FeedsParser. Parsers should override this method if they can delivery a title from the source.
The patch also adds two tests:

  • One to test the feature to retrieve a title from the feed.
  • One to ensure the feed node title is required when the CSV parser is used (because the CSV parser doesn't support providing a title from the source).
megachriz’s picture

I added a draft change record for this issue.

  • MegaChriz committed 2e7be18 on 7.x-2.x
    Issue #1621602 by MegaChriz, twistor: Fixed 'Could not retrieve title...
megachriz’s picture

Status: Needs review » Fixed

Committed #15 with minimal changes in the wording and word wrap.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.