Taking inspiration from this wonderful macro,
here is a working draft macro:
First N search results (Safari) as MD and:or opened tabs.kmmacros (27.8 KB)
If there is interest, I could add another search engine and/or browser support.
For more information, see the wiki Searching the Forum for Answers section.