Created
February 11, 2015 04:09
-
-
Save pjvandehaar/84f1100cf8f75383f939 to your computer and use it in GitHub Desktop.
how many minutes a wikipedia edit lasts
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 | |
r=requests.get('http://en.wikipedia.org/w/index.php?title=Credit_card_interest&offset=&limit=5000&action=history') | |
from bs4 import BeautifulSoup | |
soup = BeautifulSoup(r.text) | |
date_strings = (a.text for a in soup.select('a.mw-changeslist-date')) | |
from dateutil import parser | |
dates = (parser.parse(date) for date in date_strings) | |
import itertools | |
dates1, dates2 = itertools.tee(dates) | |
next(dates2) | |
date_diffs = (d1-d2 for d1,d2 in zip(dates1, dates2)) | |
secondss = (date_diff.total_seconds() for date_diff in date_diffs) | |
print(', '.join(str(s) for s in sorted(secondss))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment