Skip to content

Instantly share code, notes, and snippets.

@jeromesun14
Created November 20, 2018 10:38
Show Gist options
  • Select an option

  • Save jeromesun14/4ed353569faef0e5189e26803e20fd68 to your computer and use it in GitHub Desktop.

Select an option

Save jeromesun14/4ed353569faef0e5189e26803e20fd68 to your computer and use it in GitHub Desktop.

Revisions

  1. jeromesun14 revised this gist Nov 20, 2018. No changes.
  2. jeromesun14 revised this gist Nov 20, 2018. No changes.
  3. jeromesun14 created this gist Nov 20, 2018.
    16 changes: 16 additions & 0 deletions getLastRevised.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    # Please install BeautifulSoup4 first
    # python getLastRevised.py to run this script
    # e.g.
    # ~$ python getLastRevised.py
    # URL: 'http://iq.ul.com/ul/cert.aspx?ULID=234547' Last Revised: 2017-05-11

    from bs4 import BeautifulSoup
    import urllib2

    url = "http://iq.ul.com/ul/cert.aspx?ULID=234547"
    content = urllib2.urlopen(url)
    soup = BeautifulSoup(content, "html.parser")
    ttag = soup.find_all(id="FooterTable")
    tds = ttag[0].find_all('td')
    date = tds[-1].get_text()
    print("URL: '{}' Last Revised: {}".format(url, date))