Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/local/bin/python3
# <bitbar.title>Cotton Bureau Sales</bitbar.title>
# <bitbar.version>v2.0</bitbar.version>
# <bitbar.author>Matan Kushner</bitbar.author>
# <bitbar.author.github>matchai</bitbar.author.github>
# <bitbar.desc>Checks Cotton Bureau page for the number of sales</bitbar.desc>
# <bitbar.dependencies>python</bitbar.dependencies>
# <bitbar.emojize>true</bitbar.emojize>
import urllib.request, json, time
with urllib.request.urlopen("https://cottonbureau.com/products/anilist") as url:
data = url.read().decode()
start = "\"sold\":"
end = ","
firstChar = data.find(start)
lastChar = data.find(end, firstChar)
number_of_sales = data[firstChar + len(start):lastChar]
print(":shirt:: " + number_of_sales)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.