- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathchromeExtGUID.py
More file actions
Latest commit
33 lines (27 loc) · 877 Bytes
/
Copy pathchromeExtGUID.py
File metadata and controls
33 lines (27 loc) · 877 Bytes
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
#!/usr/bin/env python
#Given the Chrome Extension GUIDs, return the name of the extension
#Accepts GUIDs in CSV file
importurllib2, csv, sys
#open CSV File
f=open('file.csv', 'rt')
wf=open('file2.txt', 'w')
try:
reader=csv.reader(f)
forrowinreader:
#turning the cvs GUIDs to strings
test=str(row).strip('[]')
newTest=test.replace("'","")
#setting URL
URL='https://chrome.google.com/webstore/detail/'+newTest
#going to site. Get the desired extensions
response=urllib2.urlopen(URL)
site=response.geturl()
#URL returns https://chrome.google.com/webstore/detail/calmly-writer/adhdlhedoenicbbncfckobjedmboleig?hl=en
#Remove https://chrome.google.com/webstore/detail/
newSite=site[42:]
#remove the Extension GUID, everything after the /
head, sep, tail=newSite.partition('/')
printhead
wf.write(newTest+head)
finally:
f.close()