Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

weird alsec html property throwing me off 1

Status
Not open for further replies.

ChrisNome

IS-IT--Management
Mar 22, 2011
47
US
hey everyone,

i have an access module that identifies terms that are links on a website and loads them into my database. however, the website recently changed up the source code so i can no long find those terms in the links collection, where the identifier was just the .href property. The identifier for the terms is now in a property called alsec and i looked all over the html dom and can't find anything at all on it. I can access this property by looping through the links collection and using link.alsec = "identifier" but when trying to get the term it acts all goofy getting all sorts of things. Anyone have any clue how to work with this. thx

CN

 
any clue how to work with this
With what ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
work with the alsec property

say this is the format for the link I'm looking for

<a href="#" outLink="yes" alsec="identifier" alterm="word i want to get">word i want to get</a>

I used to identify this link in code by looping through the links collection, using if/then statement to find the "identifier" in the link.href, where it used to be, and it worked fine. The ws now changed the code and put the "identifier" in a property called 'alsec' leaving the link.href="#" with nothing i can identify the link with the inner text that i want other than an ambiguous 'alsec' property which seems to react at whim to the if/then statements. Any clue what this even is?

 
for instance..

if i use:

For Each link In HTMLDoc.links
If link.alsec = "identifier" Then

msgbox link.innertext

End If

Next

it will msgbox a huge number of links without the alsec property listed at all. But if i use:

For Each link In HTMLDoc.links
If link.alsec = "identifier" Then

msgbox link.innertext & " " & link.alsec

End If

Next

it will msgbox only the links i want, but i want to store the innertext of these links and can only get all the useless links from the first example, baffled...

there's nothing on google about alsec and html..

 
.. to be complete..

the link object above is an HTMLAnchorElement in the MSHTML library and i got this to work completely fine using the .href property until the ws changed up the format

 
alsec is not a standard html attribute, so no language is going to know what it is. Its probably just something for the page developer to keep some information.

If you can guarantee the value you want is always going to be there, then a direct access as you tried above would work.

If the developer is using it for something else or maybe not at all sometimes then you would get unexpected results from it.

By the way, scraping content unless given explicit permission form the website owner is considered a big no-no.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
the text I'm scraping is public domain and not copyrighted, so no worries

 
i can garantee the text i want is there. If it's not, there are no 'alsec' values of the text i want. you'd think a simple if/then construct would work, but it doesn't. i don't know why it would dispay in a msgbox all the correct text if the '.alsec' property is displayed with it for each instance, in an if/then construct, but then not display the same list but a huge number of links that don't even have that property listed when the exact same if/then construct is used. You?

Defeats logic :(

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top