Skip to content

Instantly share code, notes, and snippets.

@oltarasenko
Last active December 30, 2020 22:16
Show Gist options
  • Save oltarasenko/d8000b1209df28201d6d3fe8ca03050d to your computer and use it in GitHub Desktop.
Save oltarasenko/d8000b1209df28201d6d3fe8ca03050d to your computer and use it in GitHub Desktop.
search_results = Floki.find(document, ".ZINbbc.xpd.O9g5cc.uUPGi") |> Floki.filter_out("#st-card")
fun = fn block ->
%{title: Floki.find(block, "h3") |> Floki.text(),
description: Floki.find(block, ".BNeawe") |> Floki.text(),
link: Floki.find(block, ".kCrYT a") |> Floki.attribute("href")
}
end
Enum.map(search_results, fn element -> fun.(element) end)
%{
description: "Crawly | Definition of Crawly at Dictionary.comwww.dictionary.com › browse › crawlyCrawly definition, that crawls; noting or describing things, as worms or insects, that crawl, especially imparting a queasy feeling; creepy. See more.Crawly definition, that crawls; noting or describing things, as worms or insects, that crawl, especially imparting a queasy feeling; creepy. See more.",
link: ["/url?q=https://www.dictionary.com/browse/crawly&sa=U&ved=2ahUKEwjgoKGu0fbtAhXLILcAHQCBAbIQFjAAegQIARAB&usg=AOvVaw0g5NPkwKhc92pJv5dAMJD_"],
title: "Crawly | Definition of Crawly at Dictionary.com"
},
%{
description: "Crawly | Definition of Crawly by Merriam-Websterwww.merriam-webster.com › dictionary › crawlyCrawly definition is - creepy. How to use crawly in a sentence.Crawly definition is - creepy. How to use crawly in a sentence.",
link: ["/url?q=https://www.merriam-webster.com/dictionary/crawly&sa=U&ved=2ahUKEwjgoKGu0fbtAhXLILcAHQCBAbIQFjABegQIChAB&usg=AOvVaw3Ls_BOJVdHmvI2uTAUnscF"],
title: "Crawly | Definition of Crawly by Merriam-Webster"
},
%{
description: "crawly - Engelsk-svensk ordbok - WordReference.comwww.wordreference.com › ensv › crawlycrawly - Engelsk-svensk ordbok - WordReference.com.crawly - Engelsk-svensk ordbok - WordReference.com.",
link: ["/url?q=https://www.wordreference.com/ensv/crawly&sa=U&ved=2ahUKEwjgoKGu0fbtAhXLILcAHQCBAbIQFjACegQICBAB&usg=AOvVaw2pxNcad7KNWYxD9ryquvhU"],
title: "crawly - Engelsk-svensk ordbok - WordReference.com"
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment