Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tweets
#3
Function cTwitterDate
Code:
Copy      Help
function str&TwitterDate
ARRAY(str) a
int i=findrx(TwitterDate "(\w{3}), (\d{2}) (\w{3}) (\d{4}) (\d{2}:\d{2}:\d{2})" 0 0 a)
str sDate=F"{a[3]}-{a[2]}-{a[4]} {a[5]}"
DATE dDate=sDate
sDate.timeformat("{yyyy}{MM}{dd}{HH}{mm}{ss}" dDate)

TwitterDate=sDate

Function TwitterParse
Code:
Copy      Help
function str&Data

IXml x=CreateXml
x.FromString(Data)
Data=""
ARRAY(IXmlNode) a
x.Path("rss/channel/item" a)
int i
for i 0 a.len
,IXmlNode n=a[i].FirstChild
,for _i 0 6
,,if(!n) break
,,sel _i
,,,case 2
,,,str TimeStamp=n.Value
,,,cTwitterDate TimeStamp
,,,case 0
,,,str Title=n.Value
,,,Title.findreplace("[]" " ")
,,n=n.Next
,str Tweet=F"({TimeStamp}) {Title}"
,Data.addline(Tweet)

Yep. Pretty Much from here it's pretty simple. I ended up just putting the date at that start of a string and then populated an array. Used sort(1). Got exactly what I wanted.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)