diff --git a/index.js b/index.js index e9b9a85..3df99c3 100644 --- a/index.js +++ b/index.js @@ -11,19 +11,19 @@ function search(query) { const $ = cheerio.load(req.getBody(), { ignoreWhitespace: true }); - let synonyms = $('body #loadingContainer #root div section div p:contains("Synonyms ")').parent().parent().find('ul li span a'); + let synonyms = $('body #loadingContainer #root div section div *:contains("Synonyms ")').parent().find('ul li span a'); synonyms = synonyms.map(function() { return $(this).text(); }).get().sort(); - let antonyms = $('body #loadingContainer #root div section div p:contains("Antonyms ")').parent().parent().find('ul li span a'); + let antonyms = $('body #loadingContainer #root div section div *:contains("Antonyms ")').parent().find('ul li span a'); antonyms = antonyms.map(function() { return $(this).text(); }).get().sort(); return { - synonyms: synonyms, - antonyms: antonyms + synonyms: Array.from(new Set(synonyms)), + antonyms: Array.from(new Set(antonyms)), }; }