Skip to content

Commit f9f1a12

Browse files
authored
Merge pull request #29 from mitchcapper/detect_missing_js_files_pr
Extract probable js files from showcase.js that we missed and download them, added some additional ones
2 parents 9330314 + 133a0e2 commit f9f1a12

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

matterport-dl.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def downloadFile(url, file, post_data=None):
100100

101101
if os.path.exists(file): #skip already downloaded files except idnex.html which is really json possibly wit hnewer access keys?
102102
logging.debug(f'Skipping url: {url} as already downloaded')
103-
return;
103+
return
104104
try:
105105
_filename,headers = urllib.request.urlretrieve(url, file,None,post_data)
106106
logging.debug(f'Successfully downloaded: {url} to: {file}')
@@ -134,7 +134,9 @@ def downloadGraphModels(pageid):
134134

135135

136136
def downloadAssets(base):
137-
js_files = ["showcase","browser-check","30","79","134","136","164","250","321","356","423","464","524","539","606","614","666","764","828","833","947"]
137+
js_files = ["browser-check",
138+
"30","47","66","79","134","136","143","164","250","251","316","321","356","371","376","383","386","423",
139+
"464","524","525","539","584","606","614","666","718","721","726","764","828","833","838","932","947"]
138140
language_codes = ["af", "sq", "ar-SA", "ar-IQ", "ar-EG", "ar-LY", "ar-DZ", "ar-MA", "ar-TN", "ar-OM",
139141
"ar-YE", "ar-SY", "ar-JO", "ar-LB", "ar-KW", "ar-AE", "ar-BH", "ar-QA", "eu", "bg",
140142
"be", "ca", "zh-TW", "zh-CN", "zh-HK", "zh-SG", "hr", "cs", "da", "nl", "nl-BE", "en",
@@ -146,7 +148,7 @@ def downloadAssets(base):
146148
"es", "es-AR", "es-GT", "es-CR", "es-PA", "es-DO", "es-MX", "es-VE", "es-CO",
147149
"es-PE", "es-EC", "es-CL", "es-UY", "es-PY", "es-BO", "es-SV", "es-HN", "es-NI",
148150
"es-PR", "sx", "sv", "sv-FI", "th", "ts", "tn", "tr", "uk", "ur", "ve", "vi", "xh",
149-
"ji", "zu"];
151+
"ji", "zu"]
150152
font_files = ["ibm-plex-sans-100", "ibm-plex-sans-100italic", "ibm-plex-sans-200", "ibm-plex-sans-200italic", "ibm-plex-sans-300",
151153
"ibm-plex-sans-300italic", "ibm-plex-sans-500", "ibm-plex-sans-500italic", "ibm-plex-sans-600", "ibm-plex-sans-600italic",
152154
"ibm-plex-sans-700", "ibm-plex-sans-700italic", "ibm-plex-sans-italic", "ibm-plex-sans-regular", "mp-font", "roboto-100", "roboto-100italic",
@@ -167,6 +169,18 @@ def downloadAssets(base):
167169
assets = ["css/showcase.css", "css/unsupported_browser.css", "cursors/grab.png", "cursors/grabbing.png", "cursors/zoom-in.png",
168170
"cursors/zoom-out.png", "locale/strings.json", "css/ws-blur.css"]
169171

172+
downloadFile(base + "js/showcase.js","js/showcase.js")
173+
with open(f"js/showcase.js", "r", encoding="UTF-8") as f:
174+
showcase_cont = f.read()
175+
#lets try to extract the js files it might be loading and make sure we know them
176+
js_extracted = re.findall(r'\.e\(([0-9]{2,3})\)', showcase_cont)
177+
js_extracted.sort()
178+
for js in js_extracted:
179+
if js not in js_files:
180+
print(f'JS FILE EXTRACTED BUT not known, please file a github issue and tell us to add: {js}.js, will download for you though:)')
181+
js_files.append(js)
182+
183+
170184
for image in image_files:
171185
if not image.endswith(".jpg") and not image.endswith(".svg"):
172186
image = image + ".png"

0 commit comments

Comments
 (0)