-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextract_rain.py
More file actions
22 lines (19 loc) · 812 Bytes
/
extract_rain.py
File metadata and controls
22 lines (19 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import re, urllib.request
with open('public/assets/projects/rainy-day/webstore.html', 'r', encoding='utf-8') as f:
html = f.read()
# Video
videos = re.findall(r'https://[^\"\'\s>]+\.(?:mp4|webm)', html)
if videos:
video_url = list(set(videos))[0]
print('Downloading video:', video_url)
urllib.request.urlretrieve(video_url, 'public/assets/projects/rainy-day/trailer.mp4')
# Images
lh3 = list(set(re.findall(r'https://lh3\.googleusercontent\.com/[a-zA-Z0-9_\-]+', html)))
print('Found', len(lh3), 'images.')
for i, img_url in enumerate(lh3[:4]):
high_res_url = img_url + '=s2560'
print('Downloading image:', high_res_url)
try:
urllib.request.urlretrieve(high_res_url, f'public/assets/projects/rainy-day/screen_{i}.png')
except Exception as e:
print('Error:', e)