static L downloadYouTubeComments(S youTubeURL) { S youTubeID = extractYoutubeID(youTubeURL); File script = javaxCachesDir("YouTube Comments/downloader.py"); File out = javaxCachesDir("YouTube Comments/" + youTubeID); if (!script.exists()) saveTextFile(script, unixLineBreaks(loadSnippet(#1013723))); makeExecutable(script); S cmd = (isWindows() ? "c:\\python27\\python " : "") + platformQuote(script); for (int retry = 0; ; retry++) { if (retry >= 3) fail("Couldn't install modules"); S stdout = loadTextFile(backtickToConsole(cmd + " --youtubeid " + youTubeID + " --output " + platformQuote(out))); S missingModule = regexpFirstGroupOneOf( ll("ImportError: No module named ([a-z0-9]+)", "ImportError: ([a-z0-9]+) does not seem to be installed"), stdout); if (missingModule != null) backtickToConsole("c:\\python27\\scripts\\pip install " + missingModule); else break; } L result = map jsonDecode(linesFromFile(out)); saveTextFile(youTubeCommentsCacheFile(youTubeID), structureLines(result)); ret result; }