-
Notifications
You must be signed in to change notification settings - Fork 5
/
getPool.py
executable file
·55 lines (48 loc) · 1.8 KB
/
getPool.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Note this requires an internet connection
import os
import sys
import urllib.request
#import urllib2
response = urllib.request.urlopen("http://biorg.cis.fiu.edu/pluma/plugins.html")
page_source = str(response.read())
#print(page_source)
pool = set()
local = set()
print("")
websites =set()
# Plugin Table
while (page_source.find("</table>") != -1):
plugin_table = page_source[page_source.find("<table "):page_source.find("</table>")]
plugins = plugin_table.split("<tr>")
count=0
for plugin in plugins:
while(plugin.find("</a>") != -1):
content = plugin[plugin.find("<a href="):plugin.find("</a>")]
content = content.replace('<a href=', '')
data = content.split('>')
websites.add(data[0][1:len(data[0])-1])
plugin = plugin[plugin.find("</a>")+1:]
page_source = page_source[page_source.find("</table>")+1:]
for website in websites:
response = urllib.request.urlopen("http://biorg.cis.fiu.edu/pluma/"+website)
page_source = str(response.read())
while (page_source.find("</table>") != -1):
plugin_table = page_source[page_source.find("<table "):page_source.find("</table>")]
# Individual Plugins
plugins = plugin_table.split("<tr>")
for plugin in plugins:
while(plugin.find("</a>") != -1):
content = plugin[plugin.find("<a href="):plugin.find("</a>")]
content = content.replace('<a href=', '')
data = content.split('>')
if (len(data) == 2):
pool.add(data[1])
if (os.path.exists(data[1])):
print("Plugin "+data[1]+" already installed.")
else:
repo = data[0][1:len(data[0])-1] # Remove quotes
os.system("git clone "+repo)
plugin = plugin[plugin.find("</a>")+1:]
#normalprintout(str(count)+" ", GREEN)
#print(count,end=" ")
page_source = page_source[page_source.find("</table>")+1:]