News for hackers. Stuff that matters.
Re:Weather reports with curl by craftyguy on Monday July 09, 2018 @01:12AM (#17488103)
How stable is the output here? I noticed sections are delimited by '&&', and start with '.<SECTION TITLE>...'.

If it's stable, then it might be fun to write a cli client to query/display this..

Re:Weather reports with curl by aftbit on Monday July 09, 2018 @02:50AM (#17488409)
Five minutes in python3 + requests:

  #!/usr/bin/python
  import requests
  import re
  
  SHOW_GROUPS = ['SYNOPSIS', 'DISCUSSION', 'MTR WATCHES/WARNINGS/ADVISORIES']
  CITY = 'MTR'
  
  txt = requests.get('https://forecast.weather.gov/product.php?site=NWS&issuedby='+CITY+'&product=AFD&format=txt&version=1&glossary=0', timeout=30).text
  
  m = re.search(r'(?mis)<pre class="glossaryProduct">(.*)</pre>', txt)
  groups = m.group(1).split('&&\n')
  for g in groups:
      m = re.search(r'\.(.*?)\.\.\.', g)
      if m and m.group(1) in SHOW_GROUPS:
          print(g.strip()+'\n')
Re:Weather reports with curl by craftyguy on Monday July 09, 2018 @01:44PM (#17492017)
Yep, not hard if the input is somewhat stable...
Re:Weather reports with curl by samcheng on Monday July 09, 2018 @01:34AM (#17488181)
Probably quite stable; this stuff dates back to the telegraph...
Re:Weather reports with curl by craftyguy on Monday July 09, 2018 @02:10AM (#17488299)
source?
Re:Weather reports with curl by samcheng on Monday July 09, 2018 @02:17AM (#17488315)
Re:Weather reports with curl by craftyguy on Monday July 09, 2018 @01:46PM (#17492030)
That does not mention that the format of 'discussions' has been stable since the telegraph.. which is what I was asking about. Not the history of the NWS.