Skip to content

Instantly share code, notes, and snippets.

@nikteg
Last active March 15, 2021 16:13
Show Gist options
  • Save nikteg/c14d88d60bf6e874e1e29299d03bfd74 to your computer and use it in GitHub Desktop.
Save nikteg/c14d88d60bf6e874e1e29299d03bfd74 to your computer and use it in GitHub Desktop.

Revisions

  1. nikteg revised this gist Mar 15, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion goldenhour.1h.py
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    #!/usr/bin/env LC_ALL=en_US.UTF-8 /usr/local/bin/python3
    #
    # <bitbar.title>Golden hour</bitbar.title>
    # <bitbar.version>v0.2</bitbar.version>
    # <bitbar.version>v0.3</bitbar.version>
    # <bitbar.author>nikteg</bitbar.author>
    # <bitbar.author.github>nikteg</bitbar.author.github>
    # <bitbar.desc></bitbar.desc>
  2. nikteg revised this gist Mar 15, 2021. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions goldenhour.1h.py
    Original file line number Diff line number Diff line change
    @@ -16,8 +16,11 @@

    css_selector = "avond_goudenhour"

    request = Request("https://meteogram.org/sun/" + country + "/" + city + "/")
    url = "https://meteogram.org/sun/" + country + "/" + city + "/"
    request = Request(url)
    r = urlopen(request).read()
    soup = BeautifulSoup(r, 'html.parser')

    print("☀ " + soup.find("td", css_selector).text + " ☾")
    print(soup.find("td", css_selector).text + " | sfimage=sunset")
    print("---")
    print(soup.find("meta", { "name": "description" }).get("content").split("-")[0].strip() + " | href='" + url + "'")
  3. nikteg revised this gist Nov 9, 2020. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions goldenhour.1h.py
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    #!/usr/bin/env LC_ALL=en_US.UTF-8 /usr/local/bin/python3
    #
    # <bitbar.title>Golden hour</bitbar.title>
    # <bitbar.version>v0.1</bitbar.version>
    # <bitbar.version>v0.2</bitbar.version>
    # <bitbar.author>nikteg</bitbar.author>
    # <bitbar.author.github>nikteg</bitbar.author.github>
    # <bitbar.desc></bitbar.desc>
    @@ -20,4 +20,4 @@
    r = urlopen(request).read()
    soup = BeautifulSoup(r, 'html.parser')

    print(soup.find("td", css_selector).text)
    print("☀ " + soup.find("td", css_selector).text + " ☾")
  4. nikteg created this gist Nov 9, 2020.
    23 changes: 23 additions & 0 deletions goldenhour.1h.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    #!/usr/bin/env LC_ALL=en_US.UTF-8 /usr/local/bin/python3
    #
    # <bitbar.title>Golden hour</bitbar.title>
    # <bitbar.version>v0.1</bitbar.version>
    # <bitbar.author>nikteg</bitbar.author>
    # <bitbar.author.github>nikteg</bitbar.author.github>
    # <bitbar.desc></bitbar.desc>
    # <bitbar.image></bitbar.image>
    # <bitbar.dependencies>python</bitbar.dependencies>

    from urllib.request import urlopen, Request
    from bs4 import BeautifulSoup

    country = "sweden"
    city = "goteborg"

    css_selector = "avond_goudenhour"

    request = Request("https://meteogram.org/sun/" + country + "/" + city + "/")
    r = urlopen(request).read()
    soup = BeautifulSoup(r, 'html.parser')

    print(soup.find("td", css_selector).text)