This function takes a selector or element, and a predicate, and returns an array of the hrefs of all `a` elements in the given element matching the predicate. Useful for manual scraping. ```js window.q = (x,y=document) => y.querySelector(x) window.qq = (x,y=document) => Array.from(y.querySelectorAll(x)) function get_matching(elt,pred = x => true) { if( typeof elt == "string" ) elt = q(elt) return qq("a",elt).filter(x => pred(x.href)).map(x => x.href) } ``` You could of course make this more general, and make the above a special case: ```js window.q = (x,y=document) => y.querySelector(x) window.qq = (x,y=document) => Array.from(y.querySelectorAll(x)) function get_filter_map(elt,sel,pred = x => true,trans = x => x) { if( typeof elt == "string" ) elt = q(elt) return qq(sel,elt).filter(pred).map(trans) } function get_matching(elt,pred = x => true) { return get_filter_map(elt,"a",x => pred(x.href),x => x.href) } ```