0

Am writing an app and need to be able to grab an image from a known web page that is tweeted by someone. The link tweeted is a plixi.com link....

For example.... TWEETED: http://plixi.com/p/77873522

is a web page with an image a user has uploaded, the url of the image displayed is... http://c0013649.cdn1.cloudfiles.rackspacecloud.com/x2_4a44172

Obviously we will not know what the image url is, and will need to extract this from the the original page (http://plixi.com/p/77873522). So somehow need to connect to the page and scan it for a url maybe containing "cloudfiles.rackspacecloud" ???? However maybe not as there are several pictures (like thumbnails in the top right that contain this) Although we do know the image is always the biggest one, or is in a certain frame of the page??

One thing that may or may not help, is that the image will always be from the same plixi account.

How would we go about scanning the content of a page for such a url and getting a specific image?

joby1
  • 31
  • 1

2 Answers2

0

You have to save whole page and parse it with your own parser (for example using regular expressions). This method quick for simple tasks, though usually it is bad. If you need to grab a lot of different information from web page you better have to use parsers which understand DOM.

Look at this question parsing HTML on the iPhone This is what you need for your task. You can use Firefox Firebug extension to look for XPATH for your image

Community
  • 1
  • 1
Nik
  • 9,063
  • 7
  • 66
  • 81
0

Without knowing any specifics of iphone development, most anyone else would pick apart the page's HTML with a DOM parser, look for any identifying marks in parent elements of the photo in question, and use that to identify where on that page the site outputs the. Then later use those same identifying marks to locate the image on any other page of the site.

Firebug claims that the XPath to find the photo is //*[@id="photo"]. Maybe that'd work on other picture pages as well.

Marc B
  • 356,200
  • 43
  • 426
  • 500