Closed (fixed)
Project:
Feeds
Version:
6.x-1.0-beta10
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
28 Feb 2011 at 22:20 UTC
Updated:
4 Jun 2016 at 01:40 UTC
Jump to comment: Most recent
Comments
Comment #1
luckysmack commentedSubscribing, i'd like to know the same thing as well. I see no options to choose how many items are pulled when the feed is aggregated. An option for this would be great.
Comment #2
tfranz commentedJust a hint: I had quite a similar problem and solved it this way:
Added some code in "FeedsNodeProcessor.inc", rows 23ff:
Hope it helps somebody ... at least it works for me ... :-)
Comment #3
mlmoseley commentedAfter much reading through the code , I solved this problem by changing one line. In feeds-6.x-1.0-beta13, in:
feeds/plugins/FeedsNodeProcessor.incOn or about line 25, there's a function called:
public function process(FeedsImportBatch $batch, FeedsSource $source)That function uses the variable '$batch_size', which is the number of nodes to import, as set in settings.php with this statement:
$conf['feeds_node_batch_size'] = 10;At this point in the code, the function is looping through an array of fifty feed items, and creating nodes from them. Note: the array of feed items already exist. At the bottom of the loop the code compares $batch_size to $processed (the number of nodes processed) and provides an IF statement saying what to do if the $batch_size is equal to or greater than the number processes. In other words, when the loop has hit the limit. Here's the IF statement.
In this context 'return' is supposed to end the execution of the function, but it doesn't. It seems to just end the current iteration of the 'while' loop in which it resides. I replaced 'return' with 'break', and suddenly the node limit in settings.php worked.
This solved my problem because I needed fewer than fifty items. I don't know what would happen if you set the limit to more than fifty.
I would REALLY like to not hack a module. Really. But I just couldn't find any other solution to this.
--Marshall
Comment #4
megachrizLimiting the number of items to import can be done easily by implementing
hook_feeds_after_parse(). Via that hook all items to import are passed, so you can simply loop through them and unset the items you don't want to import.Example for Feeds 6.x-1.x:
Example for Feeds 7.x-2.x:
For skipping items that contain a certain phrase, you can also use the Keyword filter plugin from Feeds Tamper.
For skipping items that are older than a certain date, see #2453845: Limit updating items to x days.
Comment #6
sbydrupal commentedCan you please comment on #10 at https://www.drupal.org/node/1909974 whether it is possible to
solve ? I don't want to replicate same comment in this thread. Thanks
Comment #7
arne.olafson commentedI created a project for this here: https://www.drupal.org/project/single_feeds