Skip to content

Instantly share code, notes, and snippets.

@vladbatushkov
Created May 7, 2019 16:27
Show Gist options
  • Save vladbatushkov/c1e0ccd84aca3d043598504d6ebd198a to your computer and use it in GitHub Desktop.
Save vladbatushkov/c1e0ccd84aca3d043598504d6ebd198a to your computer and use it in GitHub Desktop.
Grab FM frequency of Moscow radio stations.
WITH ("http://www.morze.ru/radio_tv/radio_tv1.htm") as url
CALL apoc.load.html(url, { waves: "td.boldtabl"}) YIELD value
WITH apoc.coll.pairsMin(value.waves)[0..50] as val
UNWIND val as v
WITH toFloat(apoc.text.replace(v[0].text, ",", ".")) as fm1, toFloat(apoc.text.replace(v[1].text, ",", ".")) as fm2
WITH apoc.math.round(fm2 - fm1, 1) as diff, fm1, fm2
MERGE (w1:Wave { fm: toString(fm1) + " FM" })
MERGE (w2:Wave { fm: toString(fm2) + " FM" })
MERGE (w1)-[:NEXT { diff: diff }]->(w2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment