/ Published in: ColdFusion
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
<cfset apiKey="yourApiKeyHere">
<!--- Grab the feed --->
<cfset pitchforkFeed = XmlParse("http://feeds.feedburner.com/PitchforkBestNewAlbums?format=xml")>
<!--- Pull the titles --->
<cfset titles = XmlSearch(pitchforkFeed, "/rss/channel/item/title/")>
<!--- The titles need to be scrubbed so they actually work as arguments to the FilesTube API --->
<cfset numItems = ArrayLen(titles)>
<cfloop index="i" from="1" to=#numItems#>
<cfset artistAlbum = #titles[i].xmlText#>
<cfset noSpaceName = REREplace(artistAlbum, "&[##\d]+;", "", "ALL")>
<cfset noSpaceName = REREplace(noSpaceName, "(\s)+", " ", "ALL")>
<cfset noSpaceName = REREplace(noSpaceName, " ?- ?", " ", "ALL")>
<cfset noSpaceName = URLEncodedFormat(noSpaceName, "utf-8")>
<cfset filesTubeURL[i] = "http://api.filestube.com/?key=#apiKey#&phrase=#noSpaceName#">
</cfloop>
<!--- This is where we grab shit from the FT API --->
<cfset urlLength = ArrayLen(filesTubeURL)>
<cfloop index="j" from="1" to=#urlLength#>
<cfhttp method="Get" url="#filesTubeURL[j]#">
<!--- I should save these as a file so that processing isn't ridiculous --->
<cfset filesTubeFeed = XmlParse("#cfhttp.FileContent#")>
<cfset links = XmlSearch(filesTubeFeed, "/answer/results/hits/")>
<cfset linkLength = ArrayLen(links)>
<cfoutput>
<!--- Start outputing the urls --->
<ul>
<cfloop index="k" from ="1" to="#linkLength#">
<li>
<p>
#links[k].name.xmlText#—
#links[k].size.xmlText# <br />
</p>
</li>
</cfloop>
</ul>
</cfoutput>
</cfloop>
Comments
 Subscribe to comments
                    Subscribe to comments
                
                