Re:Tosheets, utility to send stdin to Google sheets
by gcr on Saturday November 18, 2017 @12:27AM
(#15727883)
With a domain-specific tool, it's even easier though.
curl ... | jq -r .last
Re:Tosheets, utility to send stdin to Google sheets
by sillysaurus3 on Saturday November 18, 2017 @12:28AM
(#15727884)
Sure. But you can't use jq to scrape arbitrary websites, for example. :)
Re:Tosheets, utility to send stdin to Google sheets
by dpflan on Saturday November 18, 2017 @08:52AM
(#15728922)
Jeff Atwood has an entertaining post about parsing HTML with regular expressions:
https://blog.codinghorror.com/parsing-html-the-cthulhu-way/
“”” That's right, if you attempt to parse HTML with regular expressions, you're succumbing to the temptations of the dark god Cthulhu's … er … code. “””
Re:Tosheets, utility to send stdin to Google sheets
by alexozer on Saturday November 18, 2017 @12:00PM
(#15729735)
Let's not forget about this masterpiece:
https://stackoverflow.com/a/1732454/864310
Re:Tosheets, utility to send stdin to Google sheets
by dpflan on Saturday November 18, 2017 @12:08PM
(#15729773)
Indeed, its quality cannot be ignored and must be shared; it’s referenced in the Atwood post.
Re:Tosheets, utility to send stdin to Google sheets
by ams6110 on Saturday November 18, 2017 @03:16PM
(#15730443)
Parsing and scraping are different things though. You don't need to parse a web page to extract specific things from it.
Re:Tosheets, utility to send stdin to Google sheets
by jldugger on Saturday November 18, 2017 @02:11AM
(#15728103)
Of course, if it's anything like HTML, the formatting will vary over time that you really want a more permissive parser like BeautifulSoup. I haven't found a cli interface, so I briefly wrote my own ages ago: https://github.com/jldugger/dotfiles/blob/master/bin/select.....
Re:Tosheets, utility to send stdin to Google sheets
by nurettin on Saturday November 18, 2017 @03:57AM
(#15728324)
For cases where a website is not a tutorial for websites, regex is a suitable tool for scraping.
Re:Tosheets, utility to send stdin to Google sheets
by heptathorp on Saturday November 18, 2017 @10:00AM
(#15729165)
Do NOT use r̔ͩegͩ̾ͪͥͪeͮ͊ͨ̓xͫ͆͆̓ ͤt͊͗o̒̾͋ͬ̾̚ ͆̌͌̄p͠a͟r̐̎͆̽̄ͭ́se̒ͥ ͕̪̻̭̭̺̳ͣͬͪͫͪj̞̲ͤ̚s̡̳̟̤̳̖̤͒̋ͣ͊ͤ͗̿oͬ̀͆n̮̳͚̝̩͙͔̈͋ ̮͕̩̼̔̾̈̄̋ͦ́́̚ͅĤ̷̝̯̝ͯ̈́ͣ̔ͪ̊ͬ͜͡Eͬͧ҉̜̰̲̩̰̝̠̥ ̶̯̯͚̗̪̭̘ͨͩͭ̎ͧͮCͪ҉̖͍͔͚͚̯͕Ơ̰̻̂̅̋̇̓̅͌M̸̭̱̭̥͆̽ͨͦÊ̸̴̢̪͚̮̲̜̙̍ͤ͋̾ͦS̛̗̟͙͍̹͈̳ͣ͑̏̓ͤͦ̽
That's basically a mini JSON parser in 48 characters.