Stinky Linky!
April 2, 2012 1:55 PM   Subscribe

Is there a way to define a link by the number of links into the webpage it is?

I am trying to build a spread sheet that uses a webpage as one of its data sources. The problem I am having is that the webpage in question has a list of links that are different every day.

So the main page might be something like....

Kitties04022012.html
kittiest03302012.html
Kitties02242012.html

I always want to select the first link (and there is a table once I go to that link that has my actual data). But every day the first link has a different address.

I tried using the macro editor and recording my actions in the 'Data:from Web' wizard...but ultimately it just records a static address, which will work fine today, but not tomorrow.

So is there a way I can define a link based on its position on a webpage? I have zero control over how the webpage itself displays its links.

Does that make any sense at all? :-{ Just a gentle nudge in the right direction would be greatly appreciated. :-)
posted by ian1977 to Computers & Internet (2 answers total) 1 user marked this as a favorite
 
I would look into Xpath as it should give you that functionality.

A more robust solution would be to add a class or id to the first link on the page (which would be preserved for each page update) but you might only be consuming the page.
posted by burnfirewalls at 2:01 PM on April 2, 2012


document.location.href = document.getElementsByTagName("a")[0].href
posted by tylerkaraszewski at 8:19 PM on April 2, 2012


« Older Help me name my group!   |   How to get dad to understand the benefits of... Newer »
This thread is closed to new comments.