Accessing to google drive site to get a list of python files.
#Get pyc files saved in Google drive(website)
def _getFilesInGoogleDrive():
import re;
import urllib2
pyFiles = [];
# Get page source
#url = 'https://drive.google.com/drive/u/1/folders/0Bx4LaLJqEkWQfmNXQnZtaENlWERxX2o2OHpxOUFyd0FUUTdJcWhyR3FvVVNXTm1sb01iSXc';
url = 'https://goo.gl/hIWbYY';
html = urllib2.urlopen(url).read();
# convert the source to lines
lines = html.split("\n");
# Setups
gUserName = "iron3d exists";
pyStr = ".pyc";
i3dStr = "i3d";
numpy = len(pyStr);
numi3d = len(i3dStr);
for line in lines:
srch = re.search(i3dStr,line);
if srch:
newline = (line.replace("null,","")).replace("\\n","");
spl = newline.split(gUserName);
for stri in spl:
fulllen = len(stri);
find = stri.find(i3dStr);
if find >= 0:
rightside = stri[find:fulllen];
find2 = rightside.find(pyStr);
pythonfile = rightside[0:find2+numpy];
pyFiles.append(pythonfile);
if len(pyFiles):
for pF in pyFiles: print pF;
def _getFilesInGoogleDrive():
import re;
import urllib2
pyFiles = [];
# Get page source
#url = 'https://drive.google.com/drive/u/1/folders/0Bx4LaLJqEkWQfmNXQnZtaENlWERxX2o2OHpxOUFyd0FUUTdJcWhyR3FvVVNXTm1sb01iSXc';
url = 'https://goo.gl/hIWbYY';
html = urllib2.urlopen(url).read();
# convert the source to lines
lines = html.split("\n");
# Setups
gUserName = "iron3d exists";
pyStr = ".pyc";
i3dStr = "i3d";
numpy = len(pyStr);
numi3d = len(i3dStr);
for line in lines:
srch = re.search(i3dStr,line);
if srch:
newline = (line.replace("null,","")).replace("\\n","");
spl = newline.split(gUserName);
for stri in spl:
fulllen = len(stri);
find = stri.find(i3dStr);
if find >= 0:
rightside = stri[find:fulllen];
find2 = rightside.find(pyStr);
pythonfile = rightside[0:find2+numpy];
pyFiles.append(pythonfile);
if len(pyFiles):
for pF in pyFiles: print pF;
Comments
Post a Comment