|
|
| Welcome to the Monastery | |
| PerlMonks |
Re: perl Mojo DOM CSS syntax issuesby bliako (Abbot) |
| on Jan 28, 2024 at 20:20 UTC ( [id://11157325]=note: print w/replies, xml ) | Need Help?? |
|
NERDVANA has a good point in Re: perl Mojo DOM CSS syntax issues, saying that:
In the long term this is going to be a problem. But a problem which has a solution that can be automated fully. As opposed to the problem of the website changing its structure by adding/removing divs for example. The solution to divs class/id being renamed is to keep some html documents from the website at a time when your program worked. And diff the attributes to current html. The diff will tell you how the div names/ids changed and pass that info to your script to revise its anchors. Here is my 3AM-whipped-up-code which utilises XML::Diff -- which, despite its name, works for any DOM flavour, html included:
and the result reveals the changed div ids:
The so-called diffgram can tell your program its new anchors. With the new anchors automatically fixed, all you have to do is deal with structural changes in the website. Which is a sisyphian task with a herculean twist but, hey, no standards and no APIs or obfuscating important information inide unstructured HTML is how Capitalism creates jobs for the plebes and profits for the bosess. What the legend did not tell us is that everytime Sisyphus' rock rolls back down the hill some fatcat makes a few drachmas. bw, bliako
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||