Giter VIP home page Giter VIP logo

feed-me's Introduction

Feed Me icon

Feed Me for Craft CMS

Feed Me is a Craft plugin for super-simple importing of content, either once-off or at regular intervals. With support for XML, RSS, ATOM, CSV or JSON feeds, you'll be able to import your content as Entries, Categories, Craft Commerce Products (and variants), and more.

Requirements

This plugin requires Craft CMS 5.0.0-beta.2 or later.

Installation

You can install this plugin from the Plugin Store or with Composer.

From the Plugin Store

Go to the Plugin Store in your project’s Control Panel and search for “Feed Me”. Then click on the “Install” button in its modal window.

With Composer

Open your terminal and run the following commands:

# go to the project directory
cd /path/to/my-project.test

# tell Composer to load the plugin
composer require craftcms/feed-me

# tell Craft to install the plugin
./craft plugin/install feed-me

Customizing Logs

As of version 5.6/6.2, logging is handled by Craft's log component and stored in the database instead of the filesystem. If you want them logged to files (or anywhere else), you can add your own log target in your config/app.php file:

return [
    'components' => [
        'log' => [
            'monologTargetConfig' => [
                // optionally, omit from Craft's default logs
                'except' => ['feed-me'],
            ],
            
            // add your own log target to write logs to file
            'targets' => [
                [
                    'class' => \yii\log\FileTarget::class,
                    'logFile' => '@storage/logs/feed-me.log',
                    'categories' => ['feed-me'],
                ],
            ],
        ],
    ],
];

Resources

feed-me's People

Contributors

angrybrad avatar augustmiller avatar bencarr avatar bencroker avatar benjamindavid avatar boudewijn-zicht avatar brandonkelly avatar brianjhanson avatar darinlarimore avatar domstubbs avatar engram-design avatar frankzwiers avatar gstjohn avatar gustavs-gutmanis avatar i-just avatar ishitatsuyuki avatar jacquesletesson avatar jasonmccallister avatar lindseydiloreto avatar lukeholder avatar mattstein avatar monachilada avatar monooso avatar moritzkn avatar olivierbon avatar pdaleramirez avatar smcyr avatar thomasdemarez avatar timkelty avatar vnali avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

feed-me's Issues

Question mapping assets

I am sure it's something I am doing wrong, but I've included just the file name in the feed (Lot7 as an example in this case) and if I search that name from the asset source in Craft's admin I confirmed it returns the correct result but I can't seem get it to map on import from either a XML or JSON source.

I've tried on two different fields with different sources, one which is all pdfs, the other all jpgs.

Any thoughts on what I am doing wrong? Other fields that need mapping (users, categories) seem to be working perfectly.

Thanks for your help and this add-on.

Import sometimes hangs, or does not import all entries

I have 546 entries to import. Everytime I import it it hangs. Usually it imports less than 200.

This then gets stuck in the process notice in the top right. If I import again, they are stuck in Pending, as the first process never completes. I have restore the database from a backup to start again.

FeedMe logs are empty, with no errors shown.

If I use the direct link to import, I get Internal Server 500 Errors.

Initially I thought it may be due to a low memory server, so I increased it from 1Gb to 4Gb. I still get the issues.

The error log repots this:

[Thu Sep 17 11:19:16.852241 2015] [fcgid:warn] [pid 6617] [client xx.xx.xx.xx:55379] mod_fcgid: read data timeout in 40 seconds, referer: http://mydomain/admin/feedme/feeds
[Thu Sep 17 11:19:16.852320 2015] [core:error] [pid 6617] [client xx.xx.xx.xx:55379] End of script output before headers: index.php, referer: http://mydomain.co.uk/admin/feedme/feeds

I increased the timeout to 90 seconds, but get the same error (but for 90 seconds)

I increased the timeout to Unlimited and once it finished but did not import all entries, nor are there any errors, and the second time I tried its hung again, but still no errors.

Still nothing in the Logs tag though. I'd expect to see some success status for each import and errors on any that did not import for any reason so we can fix them.

So maybe its a good idea to break it down into batches to import to keep each process time down below common timeout limits? And to offer a Stop process icon in the status dropdown in case of suck processes.

I am going to have to try to split my file into 5 different ones and create 5 different imports.

Thanks

Not mapping url from media:content

When I attempt to map a feed's media:content to a field in Craft, I'm not seeing any data. The format for media:content places the URL for the image within a URL attribute rather than as content in between opening and closing tags (like most of the other text content in the feed). I'm wondering if that's where the disconnect occurs.

When I attempt to map the field, I can see that the example data (from the most recent entry) doesn't find anything:

No content for media:content

But in my feed, the content is there like this:

<media:content url="http://uxcellence.com/content/images/2016/04/sketch-hacks-1.png" medium="image"/>

I'm attempting to map the url to a plain text field which I would then use to link to the image on the original feed's server. (I don't expect FeedMe to handle parsing a URL and saving the image to my local Craft site.)

Add onAfterImport event

It would be nice if there was an event that triggers after the import task is finished. It'd allow to run other controllers, e.g., to send email or to clean the section from superfluous entries.

Import incorrectly mapping unique fields.

I've been trying to import about 500 entries in batches of 100, but each batch does not import dozens of entries I'm expecting it to. If the Duplicate Action is set to "add" it skips the entries, and if it's set to "Update", it updates them.

However I'm positive the unique field is in-fact unique for each entry.

The unique field is a random URL string. Not sure if it's choking on processing a weird unique field such as this: http://cs-recruiting.force.com/careers/ts2__apply_to_job?nostate=1&f=a0pd0000007u3U1AAI&showJobs=100

Array to string conversion

Hi,

After creating an import and running it, I get the following error on the FeedMe control panel frontpage:

https://www.dropbox.com/s/7g7lq3wmeoputdw/Screenshot%202015-05-15%2009.52.53.png?dl=0

This is probably due to the fact that I have a multilanguage site set up, with this in my config:

'siteUrl' => array(
'no' => 'http://' . $_SERVER['SERVER_NAME'] . '/no/',
'en' => 'http://' . $_SERVER['SERVER_NAME'] . '/en/',
),

In front-end templates, doing {{ craft.config.siteUrl }} works just fine. Not sure if this is a Craft or FeedMe bug?

Only imports one item

The field mapping and import seems to work fine, only problem is: I only see one post populating. I've rerun command and deleted post only to have just one populated. Don't seem to be getting any errors. I've checked the feed url and see multiple entries. Anybody else experience this? Is there limitation on local dev environment?

Create multiple entries from one feed?

I want to pull from the weather underground API's 10 day forecast but the data is structured in a way that I need to loop through the returned JSON and create an entry in craft for each of the 10 days. I don't see a way to do that in this plugin, except for just doing it right in the template like:

{% set params = {
    url: 'http://api.wunderground.com/api/{MY_API_KEY}/forecast10day/q/CA/San_Fransisco.json',
    type: 'json',
    element: 'forecast',
    cache: 3000
} %}

{% set feed = craft.feedme.feed(params) %}
{% for node in feed %}
    {% for day in node.simpleforecast.forecastday %}
      . . .
      {{day.high.fahrenheit}}
      . . .
    {% endfor %}
{% endfor %}

But then it won't be saved as entries, which I'd like to do.
Any suggestions?

Feature requets: Delete should handle dle 404s/invalid json gracefully.

On our website, we pull down a feed from a service that's sometimes flaky (invalid or unresponsive).

I love that FeedMe can import into Craft entries - it means Craft can trivially act as a caching mechanism for the data we want to show, and can update only when we want to, without relying on the service.

However, if the "Duplicate Entry Action" is set to "Delete" (we want to update only with the current data in the feed), and the service is down, the end result is that all of the feed's entries are deleted.

Instead, it seems like FeedMe should leave any entries alone if there's a failure (either connecting and/or parsing the data), and instead only do the full-delete if everything has been successfully read.

What do you think?

CSRF Protection

If a site has CSRF Protection enabled the form submissions always fail validation. Adding...
{{ getCsrfInput() }}
within the form tags in the form template files (_edit and _map in my testing - but any other forms I've not come across yet will need this too) is the fix.

eg. (in _edit.html - line 20 on)

{% block content %}
    <form method="post" accept-charset="UTF-8" data-saveshortcut="1">
        <input type="hidden" name="action" value="">
        {{ getCsrfInput() }}

        {% if feed.id %}<input type="hidden" name="feedId" value="{{ feed.id }}">{% endif %}
...

Imports not working for Atom feeds

I have a standard, well-formed Atom XML file that I'm trying to import into Craft with FeedMe. When setting up the initial import, the data in the XML seems to be read properly by FeedMe as I can see it on the plugin page.

However when the import actually runs. The custom fields are blank. See attached screenshots for one example of this.

screen shot 2015-04-22 at 4 05 25 pm

screen shot 2015-04-22 at 4 10 14 pm

PHP Errors Importing JSON

Encountering an error when I try importing a feed from JSON:

screen shot 2015-11-17 at 5 30 11 pm

Could this be a JSON validation issue? Is there a place I can see a more detailed log?

Issue with OSes that are cap insensitive

Quick quasi-issue for people who upgraded from pre-1.4.0 versions. We found we were getting 404 errors in the console that the CSS and JS files for FeedMe weren't being found in the latest versions after upgrading from pre-1.4.0.

We found that the changed from the CSS and JS files in v. 1.4.0 from "feedme.css" to "FeedMe.css", for example, did not get picked up on in git, likely because Mac OS X if capitalization-insensitive.

Perhaps consider going back to the code looking for all-lowercase resources, and putting the CSS and JS back to the way they were in case there are others having the same issues?

Task Run but no data import?

I tried a simple xml import task and it runs but no data is created?

Its a simple xml file that just has two in it. It shows the correct fields in the field mapping setup, the task runs and completes but then no data is created.

I was getting PHP errors at first but then i raised the memory limits and those went away, but still no actual data created. Nothing in either of the feed me log tables either?

Any ideas?

Error after setting import info

Trying an import on the latest Craft version and running into this:

PHP notice

Undefined offset: 0

/var/www/craft/plugins/feedme/services/FeedMe_FeedService.php(23)

11         $url = craft()->config->parseEnvironmentString($url);
12 
13         if ($type == FeedMe_FeedType::JSON) {
14             return craft()->feedMe_feedJSON->getFeed($url, $element);
15         } else {
16             return craft()->feedMe_feedXML->getFeed($url, $element, $returnAttr);
17         }
18     }
19 
20     public function getFeedMapping($type, $url, $element) {
21         $array = $this->getFeed($type, $url, $element);
22 
23         $array = $this->getFormattedMapping($array[0]);
24 
25         return $array;
26     }
27 
28     function findPrimaryElement($element, $parsed) {
29         if (empty($parsed)) {
30             return false;
31         }
32 
33         // If no primary element, return root
34         if (!$element) {

Just a simple XML file. Known issue?

Mapping XML node attributes to field

When I read a XML feed in a template, I can access a node attribute by:
{{ xml.field.attributes.my_attribute }}

Is it also possible to map a node attribute and not just a node to a destination field when I add a feed in the backend?

Craft\FeedMe_FeedModel' not found

I'm using the plugin to move my podcast xml items to entries in a podcast section. I tried running a task to update some entries and it broke my site. Now I am unable to access the admin portion of my site. I receive the following error.

Fatal error: Class 'Craft\FeedMe_FeedModel' not found in /www/sites/mywebsite/craft/app/helpers/ModelHelper.php on line 587

I've tried replacing the app folder with a fresh copy, but nothing. Any suggestions?

Error reading namespaced RSS tags

I'm having trouble parsing an RSS feed for a podcast that includes namespaced tags (<itunes:summary>, <itunes:image>, etc.) because Twig thinks the colon is the start of a code block.

Example:

<p>Description</strong>: {{ node.itunes:summary }}</p>.
=> Unexpected token "punctuation" of value ":" ("end of statement block" expected).

What's the best way around that? This is a wonderful plugin, by the way. Great work!

Using ftp:// URLs fails

Everything is in place for using ftp (and other protocols, like file://) except for the validation caused by AttributeType::Url.
I guess the simplest way around it is using ::Uri and writing custom validations in the record/model.

I've hacked my way around it by just changing the attributetypes locally at least ...

Empty date

I'm importing a JSON feed into a section with a Date field and some of the dates are empty. Whether I set the value to null or '' today's date gets filled in. Is there a way to keep the field empty?

Setting header-parameters in API calls

It would be handy having the possibility to set header-parameters and authentication/OAuth in the API calls. e.g Placid has it. I solved it by writing a plugin between PLACID and Feedme, it works, but it would be nice to have this out of the box.

Backup removal/rotation

It would be great if the plugin could also remove/rotate older backups, as we've found very quickly running a couple of feeds you can run into GBs of database backups!

Update 1.4.10 causes JSON validation errors

It seems that the new Yii's JsonHelper class is the problem here.

feedme.log gives me : Invalid JSON. - unexpected character.

However, those JSON file have been validated before and worked quite well with 1.4.9

screen shot 2016-04-22 at 11 55 25

Duplicates delete only imports one row.

Hi,

Just updated Craft to 2.4 and Feedme to the latest version. Got some problems with the delete duplicates function, its only updating one row, if I use the update or add method everything works well and its importing more then one row.
I got nothing strange in logs. So i've no idea what happend.

Looking forward to your answer.

import not happening

I've come across a problem with Craft where I have a Channel that I made last year called 'Speakers'. I used the entry title field to capture the speaker's last name.

At the time, setting the title format like so

http://d.pr/i/1iYj8

wasn't possible and so viewing entries in that channel just gives a list of last names which is problematic when you have multiple Smiths.

Anyway, I thought I could create a new field speakerLastName - plain text, create a json template to output my speakers and then set FeedMe to update the records but doesn't seem to be happening for me.

Here's the initial settings for the feed

http://d.pr/i/1jqBH

and then

http://d.pr/i/1isVJ

I've also tried importing from an XML feed as well but same thing.

Where am I going wrong?

XML node with sub node: attributes not found

I'm not sure if I have this entirely right but it seems to me (using the template method) that when an XML node has a subnode its attributes are not pulled in using craft.feedme.feed(params). The moment I remove the subnodes I can find the attributes.

"Unable to parse feed URL" error with Wordpress ATOM feed

I'm trying to import a Wordpress ATOM feed and getting the above error when I do.

Validating the feed says it's valid but there are a few recommendations about not allowing scripts or iframes in content and about the subtitle not being blank.

Would those prevent the plugin from importing the content?

Smart quotes not getting encoded properly

This seems to be happening since I updated to 1.4.10. I haven't made any changes to my feed or the blog engine that drives it. FeedMe seems to be creating duplicate copies of my entries with the smart quotes encoded improperly. (â instead of ’)

My feed is set to "Update Entries" on Duplicate Entry Action, and I have "Check for duplicate" checked on both title and link. So for now, entries with smart quotes are created as duplicates rather than updating the original.

Here's my feed if you need it for testing: http://uxcellence.com/rss/

And here's a screenshot showing the entries as they appear on my list.

And here's a screenshot of the different entries.

PHP notice Undefined offset: 0 Error when creating a feed

Hi,

I'm getting the following error when I try and create a new XML or JSON feed.

PHP notice
Undefined offset: 0 

I'm really not sure my feeds are in a proper format. Is it possible to see an example XML or JSON feed that works with the plugin please?

Thanks

Processing fails with title":["Title is invalid."]

My first feed, which is a much more complex and large import works perfectly. Then when I came to do the very very simple one I get the error below every time:

{"title":["Title is invalid."]}

To ensure it's not an issue with our file, I've reproduced this error with a sample from w3schools:

<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
  <book category="cooking">
    <title lang="en">Everyday Italian</title>
    <author>Giada De Laurentiis</author>
    <year>2005</year>
    <price>30.00</price>
  </book>
  <book category="children">
    <title lang="en">Harry Potter</title>
    <author>J K. Rowling</author>
    <year>2005</year>
    <price>29.99</price>
  </book>
  <book category="web">
    <title lang="en">Learning XML</title>
    <author>Erik T. Ray</author>
    <year>2003</year>
    <price>39.95</price>
  </book>
</bookstore>

I get the error regardless if it's set to Add, Update or Delete duplicate entries.

I'm using Craft 2.4.2688 and have also reproduced it on 2.5 and 2.6, all running 1.4.9 of FeedMe.

In the above example I used the Title as the Title field.

If I remove the second and third elements leaving just a single element, it works fine. I suspect after completing the mapping screen, when I save the changes the mappings are lost, causing the error above as it no longer has a mapped field for the title.

I'll log a support request too so you have logs etc.

Never brought to the Field Mapping page

Click on the Save and continue to be taken to the field mapping screen

After clicking this the page refreshes and gives me a "Feed saved" notice at the top of the screen with no other errors or messages.

Working on a fresh install of:

  • Craft CMS 2.6.2780 Personal License
  • Feed Me 1.4.9

Importing data into matrix field doesn't create new blocks

I'm having an issue when I try to import some fields from my XML feed into a matrix field made up of 3 date fields (1 date and 2 time). Here is a simplified version:

...
<item>

  <eventDate>
    <date>22/12/2015</date>
    <startTime>12:00</startTime>
    <endTime>15:00</endTime>
  </eventDate>

  <eventDate>
    <date>22/12/2015</date>
    <startTime>12:00</startTime>
    <endTime>15:00</endTime>
  </eventDate>

</item>

<item>

  <eventDate>
    <date>22/12/2015</date>
    <startTime>12:00</startTime>
    <endTime>15:00</endTime>
  </eventDate>

</item>
....

e.g.
<date> -> matrixField.date
<startTime> -> matrixField.startTime
<endTime> -> matrixField.endTime

The problem is that it doesn't create a new block when there are multiple eventDate's ... It works if I only have one field in the matrix, but the second there are multiple it just replaces the contents of the first block with the next. I have also tried this with a table field and have had the same results.

Note: I tried to send you a support request through the dashboard but I'm on localhost so I don't think it worked.

Any suggestions? Cheers.

How do I access xml tag attribute values in templates?

I am having some trouble accessing the information in the an ATOM XML feed that has values stored in attributes of an xml tag within the feed. How can I access that withing the craft templates?

XML file:
<link href="http://linkprovidedbyfeed.com/link">

Craft templates:
{% for post in posts %} <li> <a href="{{ post.link }}">{{ post.title }}</a> </li> {% endfor %}

Failed import with auto-generated titles

My imports fail when a section has the title set to auto-generate based on other fields.
The error shows as Import: {"title":[" cannot be blank."]}

Removing this does solve the problem, but all entry titles then need to be adjusted.

Is there a way to support importing with auto-generated titles?

Add composer support

Example

{
    "name": "engram-design/feedme",
    "description": "Feed Me is a Craft plugin to make it easy to import entries and entry data from XML, RSS, ATOM or JSON feeds.",
    "authors": [
        {
            "name": "",
            "email": ""
        }
    ],
    "type": "craft-plugin",
    "require": {
        "composer/installers": "~1.0"
    }
}

Mapping with inconsistent primary element name

I need to import the latest articles added to Pocket,
but unfortunately the Pocket API JSON passes items with ID.

There is a way to get all the childrens of "list" as primary element for mapping?

Something like: list/*
Thanks!

pocket_json

FeedMeError - Columns and data did not match, could be due to malformed feed

I'm trying to run an import but i keep getting this error. Even when i tell the system to only import the title and the slug and ignore all other fields. Have also tried eliminating all the other fields in the XML, with no result.

Could you point me in the right direction?

Log Date
"Started importing node: 0" 14 mei 2015 18:43:32
{"feed":[],"items":1,"logsId":"15"} 14 mei 2015 18:43:32
"FeedMeError - Columns and data did not match, could be due to malformed feed." 14 mei 2015 18:43:32

XML feed = http://www.calco.nl/development/export

Bas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.