Last active
March 15, 2021 16:13
-
-
Save nikteg/c14d88d60bf6e874e1e29299d03bfd74 to your computer and use it in GitHub Desktop.
Revisions
-
nikteg revised this gist
Mar 15, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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.3</bitbar.version> # <bitbar.author>nikteg</bitbar.author> # <bitbar.author.github>nikteg</bitbar.author.github> # <bitbar.desc></bitbar.desc> -
nikteg revised this gist
Mar 15, 2021 . 1 changed file with 5 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,8 +16,11 @@ css_selector = "avond_goudenhour" 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 + " | sfimage=sunset") print("---") print(soup.find("meta", { "name": "description" }).get("content").split("-")[0].strip() + " | href='" + url + "'") -
nikteg revised this gist
Nov 9, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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.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 + " ☾") -
nikteg created this gist
Nov 9, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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)