It returns the first result, but even then, what happens if, instead of a hardcoded link, it's a description that indicates that the next link it's going to be the unsuscribe one.
Proposed solution
The search of the unsubscribe button of a newsletter by mail, should actually search recursively from the document.body, until reaching the element, or the elements closer to, whichever may be the unsuscribe link, would be an idea, but it is not necessarily reliable nor does it guarantee a good/wanted result.
Another alternative may be to simply look at the URL, but some advanced newsletters may be using URL ofuscation or shortening, which would ruin the idea, as URLs do not necessarily have to be user-friendly.
It returns the first result, but even then, what happens if, instead of a hardcoded link, it's a description that indicates that the next link it's going to be the unsuscribe one.
Proposed solution
The search of the unsubscribe button of a newsletter by mail, should actually search recursively from the
document.body, until reaching the element, or the elements closer to, whichever may be the unsuscribe link, would be an idea, but it is not necessarily reliable nor does it guarantee a good/wanted result.Another alternative may be to simply look at the URL, but some advanced newsletters may be using URL ofuscation or shortening, which would ruin the idea, as URLs do not necessarily have to be user-friendly.