Index: main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/errata-categories/CREATE-VENV-PYTHON3.sh
===================================================================
--- main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/errata-categories/CREATE-VENV-PYTHON3.sh	(revision 34973)
+++ main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/errata-categories/CREATE-VENV-PYTHON3.sh	(revision 34973)
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+my_env="my-python3"
+
+
+if [ ! -d "$PWD/$my_env" ] ; then
+    # python3 -mvenv "$PWD/$my_env"
+    ./virtualenv-16.7.10/virtualenv.py --python=python3 "$my_env"    
+else
+    echo "" >&2
+    echo "!!!!!!!!" >&2
+    echo "! VirtualEnv Python3 already exists:" >&2
+    echo "!   $PWD/$my_env" >&2
+    echo "! => Not doing anything to create a Python virtualenv" >&2
+    echo "!!!!!!!!" >&2
+fi
+
+echo "****"
+echo "* To activate this version of python, enter:" 
+echo "*   source \"$PWD/$my_env/bin/activate\""
+echo "*"
+echo "* Once activated, required packages that need to be added to '$my_env'"
+echo "*   pip3 install wikipedia beautifulsoup4"
+echo "****"
+
+
+##./virtualenv-16.7.10/virtualenv.py --python=python3 my-python3
Index: main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/errata-categories/esc-wikipedia-download-and-process-votes.py
===================================================================
--- main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/errata-categories/esc-wikipedia-download-and-process-votes.py	(revision 34973)
+++ main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/errata-categories/esc-wikipedia-download-and-process-votes.py	(revision 34973)
@@ -0,0 +1,99 @@
+#!/usr/bin/env python
+
+from __future__ import print_function
+
+import os
+
+import bs4
+import wikipedia
+
+
+cache_dir="cache-wikipedia"
+
+
+def read_text_file(input_filename):
+    f = open(input_filename, "r")
+    text = f.read()
+    f.close()
+
+    return text
+
+def write_text_file(output_filename, text):
+    f = open(output_filename, "w")
+    f.write(text)
+    f.close()
+
+    
+
+def process_category_page(year):
+    esc_wiki_page = "Eurovision_Song_Contest_" + str(year)
+    esc_wiki_page_file = esc_wiki_page.replace(" ","_") + ".html"
+    esc_wiki_page_filename = os.path.join(cache_dir,esc_wiki_page_file)
+
+    esc_year_html = ""
+    if not(os.path.exists(esc_wiki_page_filename)):
+        print("Retrieving Wikipedia page '" + esc_wiki_page + "'")
+        esc_year_wp = wikipedia.page(esc_wiki_page,auto_suggest=False,preload=True,redirect=True)
+        esc_year_html = esc_year_wp.html()
+
+        print("  Saving page to cache")
+        write_text_file(esc_wiki_page_filename,esc_year_html)
+    else:
+        print("Retrieving " + esc_wiki_page_file + " from cache")
+        esc_year_html = read_text_file(esc_wiki_page_filename)
+
+        
+    esc_year_soup = bs4.BeautifulSoup(esc_year_html, 'html.parser')
+    
+    final_result_ids = [ 'Grand_final', 'Final', 'Results' ]
+
+    results_heading = None
+    for fr_id in final_result_ids:
+        
+        results_text_span = esc_year_soup.find(id=fr_id)
+        if (results_text_span is not None):
+            print("  Found Final Results heading with id: " + fr_id);
+            results_heading = results_text_span.parent        
+            break
+
+    # print (results_heading)
+
+    results_table = results_heading.findNext('table')
+    table_rows = results_table.find_all('tr');
+
+    print(esc_wiki_page_file + ": number of rows in Results table = " + str(len(table_rows)))
+
+    
+if __name__ == "__main__":
+    # https://en.wikipedia.org/wiki/Eurovision_Song_Contest_1956
+
+    # https://en.wikipedia.org/wiki/Category:Countries_in_the_Eurovision_Song_Contest_1957
+
+    if not(os.path.exists(cache_dir)):
+        print("Making cache directory: " + cache_dir)
+        os.mkdir(cache_dir)
+            
+    for year in range(1956, 2020):
+        process_category_page(year)
+
+    
+#    for row in table_rows:
+#        print("*** " + repr(row));
+        
+#    for sibling in results_heading.previous_siblings:
+#        print(repr(sibling))
+
+    
+
+
+    
+    #td_tag.findNext('td')
+
+    # results_table = results_heading.findNext('table')
+    # print(repr(results_table))
+
+
+#ny = wikipedia.page("New York")
+#ny.html()
+#soup = BeautifulSoup("<html>a web page</html>", 'html.parser')
+#id_soup.p['id']    
