···6060 // Find all anchors that href to preview.redd.it, i.redd.it, i.imgur.com
6161 // and contain just a link to the same href
6262 const expression = /<a href="(http[s]?:\/\/(?:preview\.redd\.it|i\.redd\.it|i\.imgur\.com).*?)">\1?<\/a>/g;
6363- const matches = html.matchAll(expression);
6363+ const matches = Array.from(html.matchAll(expression));
6464 var result = html;
6565 matches.forEach((match) => {
6666 // Replace each occurrence with an actual img tag
···8585 var poster_url = p.preview && p.preview.images ? p.preview.images[0].source.url.replace(expression, '&') : '';
86868787 return [hls_url, dash_url, fallback_url, scrubber_url, poster_url];
8888- }8888+ }