Posted by serbanghita on February 23, 2010 at 8:31am
| Project: | Feeds |
| Version: | 6.x-1.0-alpha11 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (won't fix) |
| Issue tags: | custom field, custom mapping, custom parser, Feeds |
Issue Summary
I am fetching the following feed http://search.twitter.com/search.atom?q=starcraft2 and i'm creating nodes out of it, i am using SimplePie library.
I'm not sure how to extract: from a RSS entry. Please check attached sample.
Do i have to code something custom or am i missing something.
PS: i am also interested in fetching this type of resources in 2 ways: plain text value 'http://s.twimg.com/a/1266868794/images/default_profile_4_normal.png' or uploaded image on my drive as a file. Should this be a new feature?
Thanks!
| Attachment | Size |
|---|---|
| feed-item-sample.txt | 1.32 KB |
Comments
#1
The actual tag got eaten up by the output filter. Please clarify.
#2
Yep, sorry about that.
The actual line is
<link type="image/png" href="http://s.twimg.com/a/1266868794/images/default_profile_4_normal.png" rel="image"/>, you can see it in the sample file: http://drupal.org/files/issues/feed-item-sample.txt#3
Isn't that just the item's URL?
#4
No, actually the URL is mapped to
<link type="text/html" href="http://twitter.com/nolanstrong/statuses/9516556206" rel="alternate"/>(this is above the<link type="image/png" ...>).I don't know how to map the
<link type="image/png" ...>field.Check the sample code closely: http://drupal.org/files/issues/feed-item-sample.txt
#5
Sorry - overlooked that.
I am not sure whether this Atom image link field should be treated like an enclosure in RSS. I am also not sure to what extent either common_syndication_parser or simplepie (the two parsers available in Feeds) actually do make this field available but their bridge classes (FeedsSyndicationParser and FeedsSimplePieParser) don't expose it to Feeds.
Requires digging through the code. Start at plugins/FeedsSyndicationParser.inc and plugins/FeedsSimplePieParser.inc
In more general terms, it would help if our syndication parsers were more extensible. They are not.
#6
Thanks for the reply.
I will look into that, and reply when i find a solution or get stuck. Thanks!
#7
@serbanghita - How you progressing? I need to build out a similar solution - Should we compare notes?
#8
This patch might be the solution: #706984: Allow extension of FeedsSimplePieParser parsing - it is committed to head.
#9
@webdeli - i did it, i'll post the code here tonight. keep close.
#10
@serbanghita - That would be great. I can use this on a project today. If I have the opportunity I will make a contribution to the developer docs to clarify. Did you use the documented "MyParser extends FeedsParser" technique and if yes did you create a spereate module folder or did you edit the Feed module files? In any event - please do post your material, I look forward to being able to do this correctly.
#11
subscribe
#12
#13
I have attached my working module Twitter Feeds.
Please check out the screenshot, that is the kind of data you will get from a twitter search feed. Just copy paste /feeds_twitter/ dir in /sites/all/modules/ and enable the module.
#14
With the default parser I am importing 15 nodes. At the moment, with the feeds_twitter parser I am only getting 1 node created. Comparing the code to work out why.
#15
@webdeli - hmm, tell me the feed, so i can test it. Did you mapped the twitter fields to the node fields? I don't have problems. Are you using alpha11 or alpha12 release?
#16
@serbanghita - I would like to invite you to contact me direct via the drupal contact form. I suggest we work together to make this and contributed actual module. Please click on "webdeli" and you should see a contact tab for me here at Drupal.org
Added: Twitter feed I am looking to use is -> "http://search.twitter.com/search.atom?lang=en&q=canberra+politics"
Running: 6.x-1.0-alpha12
In testing I uncommented the "print_r($items);" line 35.
The output from the print_r($items) statement outputs each entry twice. normal? expected?
#17
#13: That's smart - you avoid the heavy logic done by common_syndication_parser or by SimplePie by tailoring your parser to Twitter feeds only. Nice work. Are you planning on releasing this as a separate project on d. o.? I would recommend that, thus you can take real ownership over maintaining the Twitter parser.
#18
@webdeli: here is the flow i followed to have your twitter feed imported into nodes using Feeds + Feeds Twiter http://docs.google.com/View?docID=0ASQtGO_4iSjZZHR2bWpwcl8yMDVkN3RmdnFndg ; We need to make the whole process work automatically, when you activate Feeds Twitter module.
@alex_b: i am still weaving my way through Drupal and i am not fully prepared to maintain a module yet still i would like to try that. Not sure what you mean in the last sentence. You mean i can write the whole deal described in the Google Docs link (create a node type, add cck fields to it) into FeedsTwitterParser.inc and integrate it directly in Feeds?
#19
You mean i can write the whole deal described in the Google Docs link (create a node type, add cck fields to it) into FeedsTwitterParser.inc and integrate it directly in Feeds?
Yes. All configuration in Feeds is exportable. Take a look at feeds_defaults module that's included in Feeds.
#20
subscribe
#21
subscribe.
#22
@alex_b could you please review this module request: http://drupal.org/node/804738#comment-3035188
Thanks!
#23
#22: I am subscribed to #804738: serbanghita [serbanghita] now. Setting this issue to won't fix as the plan of action is to release this functionality as separate module.