1 | static L<Map> downloadYouTubeComments(S youTubeURL) {
|
2 | S youTubeID = extractYoutubeID(youTubeURL); |
3 | File script = javaxCachesDir("YouTube Comments/downloader.py");
|
4 | File out = javaxCachesDir("YouTube Comments/" + youTubeID);
|
5 | if (!script.exists()) |
6 | saveTextFile(script, unixLineBreaks(loadSnippet(#1013723))); |
7 | makeExecutable(script); |
8 | S cmd = (isWindows() ? "c:\\python27\\python " : "") + platformQuote(script); |
9 | |
10 | for (int retry = 0; ; retry++) {
|
11 | if (retry >= 3) fail("Couldn't install modules");
|
12 | |
13 | S stdout = loadTextFile(backtickToConsole(cmd + " --youtubeid " + youTubeID + " --output " + platformQuote(out))); |
14 | S missingModule = regexpFirstGroupOneOf( |
15 | ll("ImportError: No module named ([a-z0-9]+)",
|
16 | "ImportError: ([a-z0-9]+) does not seem to be installed"), stdout); |
17 | if (missingModule != null) |
18 | backtickToConsole("c:\\python27\\scripts\\pip install " + missingModule);
|
19 | else |
20 | break; |
21 | } |
22 | |
23 | L<Map> result = map jsonDecode(linesFromFile(out)); |
24 | saveTextFile(youTubeCommentsCacheFile(youTubeID), structureLines(result)); |
25 | ret result; |
26 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1017636 |
| Snippet name: | downloadYouTubeComments - needs Python 2 |
| Eternal ID of this version: | #1017636/1 |
| Text MD5: | 624851f39551fee43e215937a571c0b9 |
| Author: | stefan |
| Category: | javax / networking |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-07-31 13:22:07 |
| Source code size: | 1124 bytes / 26 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 588 / 627 |
| Referenced in: | [show references] |