Created
January 3, 2014 01:39
-
-
Save duk3luk3/8231009 to your computer and use it in GitHub Desktop.
scraper. requires the requests lib. python3. https://www.digitalocean.com/blog_posts/be-the-1-000-000th-droplet-in-the-digitalocean-to-win-10k
This file contains 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 characters
import requests | |
import time | |
import re | |
while True: | |
t = time.asctime() | |
r = requests.get('http://digitalocean.com') | |
lines = r.text.split("\n") | |
nums = [] | |
for l in lines: | |
m = re.search(r"(?<=count'>)\d",l) | |
if m: | |
nums.append(m.group(0)) | |
if (len(nums)>0): | |
n = 0 | |
for i in range(len(nums)): | |
m = len(nums)-i-1 | |
n = n + int(nums[i])*10**m | |
print(t) | |
print(n) | |
time.sleep(30) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment