01-06-2009, 06:37 PM
Totally great. I didn't know it'd be that simple d.GetForm() never knew about that. Wouldn't have figured it out without you! Thanks a bunch.
Here is some code I worked out with notes. Changed a few things around. Need help with UNIQUE database entries. Thanks again!
Many thanks,
Jimmy Vig
Here is some code I worked out with notes. Changed a few things around. Need help with UNIQUE database entries. Thanks again!
#compile CSqlite
str dbfile="$desktop$\Shows.db3"
str sql
CSqlite db1.Open(dbfile)
db1.Exec("CREATE TABLE IF NOT EXISTS Band (DateTime,Venue,Address,City,Zip_Code,State,Cost,Description)")
;;To prevent duplicate entries
;;Will use Band as it's own Table
;;Cannot use FriendID because there will be non-myspace data being inputed into database as well.
;;Will use DateTime as Unique ID
;;If duplicate entry exists - Need to have new data take priority and replace old data
out
str friendID="433427838";;Glitch in mypsace isn't showing Joey Figgiani's Name at all??
str Band="Tripwire"
str url.format("http://collect.myspace.com/index.cfm?fuseaction=bandprofile.listAllShows&friendid=%s" friendID)
HtmlDoc d.InitFromWeb(url)
str s=d.GetHtml
ARRAY(POSTFIELD) a
int i
for i 1 1000000
,d.GetForm(i 0 0 a); err break
,if(a[0].name~"calEvtLocation"=0) break
,;;Replaces funky characters with " ' "
,;;Is there any other way to replace all the funky characters?
,;;Are there any other funky characters that might pop up?
,a[0].value.findreplace("[226][128][153]" "'")
,;;DEBUG DATA
;,out a[0].value;;Returns Venue
,
;,out a[1].value;;Returns Event Title
,;;(Note for a[1]: only returns text " at Venue"
,;;;checked with str s=d.GetHtml; out s
,;;;It is in the QM HTML as " at Venue"
,;;;Checked in Firefox view source and is "BandName at Venue"
,;;;Not sure if QM or MySpace glitch.
,;;;Really it's fine, if friend ID is known, band name is known...except if band changes name
,;;;Could grab band name from text "All Shows for BANDNAME" to reference what is in database
,;;;If band name changes, what happens to data?
,
,;out a[2].value;;Returns Address
,;out a[3].value;;Returns City
,;out a[4].value;;Returns State
,;out a[5].value;;Returns Zip
,;out a[6].value;;Returns DateTime
,
,out "---------------------"
,str Venue=a[0].value
,str Address=a[2].value
,str City=a[3].value
,str State=a[4].value
,str Zip=a[5].value
,str DateTime=a[6].value
,str Event.format("'%s','%s','%s','%s','%s','%s'" DateTime Venue Address City State Zip)
,out EventMany thanks,
Jimmy Vig
