Stephen's Janky Tour Pool Software

See an example of this in action here:


This has only ever been used on a Linux machine. It's highly likely that it would be straightforward to get working on Mac OS X. On Windows, no idea!

  • Python > 3.6
  • PHP on your web server
  • Python packages:
    • BeautifulSoup4
    • Numpy
    • Plotly

How To Get Started

  1. Download this repository using Mercurial, or by using the "Downloads" link on the left side of the page.
  2. In the file named "", at the beginning of the Tour, edit content below the lines that say # --- EDIT BELOW HERE DAILY ---- # and # --- EDIT HERE AT THE BEGINNING OF THE TOUR ---- #. Also, make sure that the very first line points to your location for Python 3.6 (or higher).
  3. At the beginning of the tour:
    1. add the teams in the order that they were drafted. You can see the examples that are already in the file. Note that the number just before the double close parentheses )) should increase by one for each entry. Also, the numbers start at 0.
    2. In the file graph.gnuplot, update the stage descriptions (if desired), and update the names at the bottom to match the draft order.
    3. Also, if you like, you can update the LeTour link under the function named printResultsLinks to the new year.
    4. Update the year values in index.php to the new year.
  4. Daily, edit:
    1. stageBonuses; Add a new line after every stage with the top three finishers. On TTT stages, enter 888 for all three values in order to not award any bonuses for those stages.
    2. HTMLnames: Add a new entry to the list naming the content of the HTML source that was scraped (see below).
    3. JerseyBonus: Update the six entries of this item to the current Green and Polka Dot jersey owners. The first three entires are for the Green jersey rankings, and the last three are for top three Polka Dot rankings.
    4. dropped: Add a new entry after each stage. I find that it's simplest to add and empty list and then run the script (below) and see what riders have unpysically good times. They have most likely left the tour. You can re-run the script after updating dropped.
    5. You need to scrape some of the HTML off of the website. Go to the full overall classification and you can copy the needed HTML by following the example in this video: (you may have to download the file to your computer, and drag it to your browser, to play it). The key is too look for the code="ITG" tag. The content of the clipboard (which is what is captured with the "Copy" command) should be saved to a file in the same directory as the script. I typically name them by stage, so "01.html", "02.html", etc.
    6. To run everything, call ./

How to View

Just put all these files on a webserver, and point your browser to this location. If you have PHP working correctly, the results should just appear!


This code is some of my earliest Python code. It is not stellar nor stable. If I were to do this again, I'd do a much better job. But since this code isn't paying the bills, and it works as is, I haven't updated it.

Stephen Skory 5 July 2015