Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#169 2012-05-22 14:00:58

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 687
Website Mastodon

Re: smd_xml : extract data from XML feeds

Did so, thank you again.


A hole turned upside down is a dome, when there’s also gravity.

Offline

#170 2012-06-26 19:53:49

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

Re: smd_xml : extract data from XML feeds

how do you mix two or more feeds? do they have to be premixed using yahoo pipes?

is importing the feeds into the database and letting textpattern mix them the next option?

also i put this code from the example into a page template, and it brought the page down and wouldn’t render anything. i did install smd_query

<txp:smd_xml data="http://feeds.delicious.com/v2/rss/myUserName"
record="item" fields="title|utitle, link, pubDate, description, category"
format="pubDate|date|%Y-%m-%d %H:%I:%S,
description|escape, title|escape, utitle|sanitize|url_title">
<txp:smd_query query="INSERT INTO textpattern
SET Posted='{pubDate}', LastMod=NOW()
url_title='{utitle}',
Title='{title}', custom_3='{link}',
Body='{description}', Body_html='{description}',
Section='links', Category1='delicious',
keywords='{category}'" />
</txp:smd_xml>

Offline

#171 2012-06-26 20:11:26

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: smd_xml : extract data from XML feeds

The comma behind LastMod=NOW()?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#172 2012-06-26 20:14:11

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

Re: smd_xml : extract data from XML feeds

uli wrote:

The comma behind LastMod=NOW()?

no that did not fix it, neither did LastMod='NOW()',

also i’m running this test site on xampp, not sure if it would affect anything.

{Edited to add @‘s: Textile swallowed parentheses otherwise. – Uli}

Last edited by uli (2012-06-26 20:34:25)

Offline

#173 2012-06-26 20:45:17

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: smd_xml : extract data from XML feeds

mrtunes

It works for me with the latest beta (though I’m running a development copy of smd_query too, that shouldn’t affect it).

Can you output stuff from your feed to the screen inside the smd_xml container ok?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#174 2012-06-26 20:59:55

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

Re: smd_xml : extract data from XML feeds

Bloke wrote:


It works for me with the latest beta (though I’m running a development copy of smd_query too, that shouldn’t affect it).
Can you output stuff from your feed to the screen inside the smd_xml container ok?

yes it’s outputting without the query section. so i’m going to now assume it’s something to do with running a local server. the problem is i dont want to test on a live one, and then spit articles into the rss feed.

Last edited by mrtunes (2012-06-26 21:00:15)

Offline

#175 2012-06-26 21:09:31

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: smd_xml : extract data from XML feeds

mrtunes wrote:

yes it’s outputting without the query section. so i’m going to now assume it’s something to do with running a local server.

Or maybe it’s a problem with smd_query. Wanna try my version?

Last edited by Bloke (2012-06-26 21:09:59)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#176 2012-06-27 19:54:19

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

Re: smd_xml : extract data from XML feeds

Bloke wrote:

Or maybe it’s a problem with smd_query. Wanna try my version?

Ok. where do i grab it?

also did you see my other question about mixing multiple feeds?

Offline

#177 2012-09-19 17:37:32

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: smd_xml : extract data from XML feeds

Hi Stef, I’m trying to parse a youtube feed. The link field appears many times, but I would like to use only the first occurrence. Is it possible? The concat parameter let me use the last, and that’s not useful for me. A related question: the link fields appear with different attributes. Is it possible to target only the fields that has some attribute and not the others? E.g.

<entry>
<id>http://gdata.youtube.com/feeds/api/videos/XXXXX</id>
...
<link rel="alternate" type="text/html" href="https://www.youtube.com/watch?v=XXXXX&amp;feature=youtube_gdata"/>
<link rel="http://gdata.youtube.com/schemas/2007#video.responses" type="application/atom+xml" href="https://gdata.youtube.com/feeds/api/videos/XXXXX/responses"/>
<link rel="http://gdata.youtube.com/schemas/2007#video.related" type="application/atom+xml" href="https://gdata.youtube.com/feeds/api/videos/XXXXX/related"/>
<link rel="http://gdata.youtube.com/schemas/2007#mobile" type="text/html" href="https://m.youtube.com/details?v=XXXXX"/>
<link rel="self" type="application/atom+xml" href="https://gdata.youtube.com/feeds/api/users/p40it/uploads/XXXXX"/>
</entry>

I’d like to use the href content of the first link. There is a way I could try to use type or rel=“alternate” to target it?

Offline

#178 2012-09-19 19:49:25

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: smd_xml : extract data from XML feeds

Stef, may I..?

Offline

#179 2012-09-19 20:00:27

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: smd_xml : extract data from XML feeds

etc wrote:

Stef, may I..?

Be my guest. This plugin has rotted to the point I was considering overhauling it, then yours came along so I didn’t need to bother!

Although istr the latest smd_xml beta will do what Zanza wants, I’d have to refresh my memory on what options to use to do it, and it may well involve smd_if. Yours will be faster, I’m sure.

Last edited by Bloke (2012-09-19 20:00:56)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#180 2012-09-19 20:22:02

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: smd_xml : extract data from XML feeds

Thanks for the welcome, sir!

Bloke wrote:

Yours will be faster, I’m sure.

Not at all, the network connection to youtube will take 99.99% of time with both anyway. I simply think xpath is a right thing to use here. Importing the first link’s href takes no more than

<txp:etc_query url="...youtube..." markup="xml" query="string(//entry/link[1]/@href)" />

provided there is only one entry in the feed.

Offline

Board footer

Powered by FluxBB