initial commit
This commit is contained in:
154
python-webrequest.txt
Normal file
154
python-webrequest.txt
Normal file
@@ -0,0 +1,154 @@
|
||||
import requests
|
||||
from time import time
|
||||
from time import sleep
|
||||
from contextlib import chdir
|
||||
import copy
|
||||
|
||||
headerz = {'Accept' : 'image/avif,image/webp,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5', 'Accept-Encoding' :
|
||||
'gzip, deflate, br, zstd', 'Accept-Language' :
|
||||
'en-CA,en-US;q=0.9,en;q=0.8', 'Referer' :
|
||||
'https://www.portvancouver.com/' }
|
||||
|
||||
milliseconds = int(time() * 1000)
|
||||
image_check = requests.get("https://ehub.portvancouver.com/Webcams/Photos/CommOver?" + str(milliseconds))
|
||||
x2 = requests.get("https://ehub.portvancouver.com/webcams/Photos/DPWExitWest?" + str(milliseconds))
|
||||
x3 = requests.get("https://ehub.portvancouver.com/Webcams/Photos/CentermMainGates?" + str(milliseconds))
|
||||
x4 = requests.get("https://ehub.portvancouver.com/Webcams/Photos/VantermEntrance?" + str(milliseconds))
|
||||
x5 = requests.get("https://ehub.portvancouver.com/Webcams/Photos/VantermGates?" + str(milliseconds))
|
||||
x6 = requests.get("https://ehub.portvancouver.com/Webcams/Photos/ClarkEntrance?" + str(milliseconds))
|
||||
x7 = requests.get("https://ehub.portvancouver.com/Webcams/Photos/ColumbiaContainerCrossing?" + str(milliseconds))
|
||||
x8 = requests.get("https://ehub.portvancouver.com/webcams/Photos/TerminalDock?" + str(milliseconds))
|
||||
x9 = requests.get("https://ehub.portvancouver.com/Webcams/Photos/CommEntrance?" + str(milliseconds))
|
||||
x10 = requests.get("https://ehub.portvancouver.com/Webcams/Photos/CommOverMcGill?" + str(milliseconds))
|
||||
|
||||
|
||||
|
||||
while True:
|
||||
milliseconds = int(time() * 1000)
|
||||
str1 = "https://ehub.portvancouver.com/Webcams/Photos/CommOver?" + str(milliseconds)
|
||||
str2 = "https://ehub.portvancouver.com/webcams/Photos/DPWExitWest?" + str(milliseconds)
|
||||
str3 = "https://ehub.portvancouver.com/Webcams/Photos/CentermMainGates?" + str(milliseconds)
|
||||
str4 = "https://ehub.portvancouver.com/Webcams/Photos/VantermEntrance?" + str(milliseconds)
|
||||
str5 = "https://ehub.portvancouver.com/Webcams/Photos/VantermGates?" + str(milliseconds)
|
||||
str6 = "https://ehub.portvancouver.com/Webcams/Photos/ClarkEntrance?" + str(milliseconds)
|
||||
str7 = "https://ehub.portvancouver.com/Webcams/Photos/ColumbiaContainerCrossing?" + str(milliseconds)
|
||||
str8 = "https://ehub.portvancouver.com/webcams/Photos/TerminalDock?" + str(milliseconds)
|
||||
str9 = "https://ehub.portvancouver.com/Webcams/Photos/CommEntrance?" + str(milliseconds)
|
||||
str10 = "https://ehub.portvancouver.com/Webcams/Photos/CommOverMcGill?" + str(milliseconds)
|
||||
|
||||
|
||||
image_name = "image" + str(milliseconds) + ".jpg"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
x1 = requests.get(str1, headers=headerz)
|
||||
if x1.content != image_check.content:
|
||||
with chdir('Commissioner entrance'):
|
||||
if x1.status_code == 200:
|
||||
with open(image_name, 'wb') as f:
|
||||
f.write(x1.content)
|
||||
else:
|
||||
print("Copy detected and removed (x1)")
|
||||
|
||||
image_check = copy.deepcopy(x2)
|
||||
x2 = requests.get(str2, headers=headerz)
|
||||
if x2.content != image_check.content:
|
||||
with chdir('Waterfront_road Centerm crossing'):
|
||||
if x2.status_code == 200:
|
||||
with open(image_name, 'wb') as f:
|
||||
f.write(x2.content)
|
||||
else:
|
||||
print("Copy detected and removed (x2)")
|
||||
|
||||
image_check = copy.deepcopy(x3)
|
||||
x3 = requests.get(str3, headers=headerz)
|
||||
if x3.content != image_check.content:
|
||||
with chdir('Centerm in gate'):
|
||||
if x3.status_code == 200:
|
||||
with open(image_name, 'wb') as f:
|
||||
f.write(x3.content)
|
||||
else:
|
||||
print("Copy detected and removed (x3)")
|
||||
|
||||
|
||||
image_check = copy.deepcopy(x4)
|
||||
x4 = requests.get(str4, headers=headerz)
|
||||
if x4.content != image_check.content:
|
||||
with chdir('Vanterm Alliance Grain Terminal crossing'):
|
||||
if x4.status_code == 200:
|
||||
with open(image_name, 'wb') as f:
|
||||
f.write(x4.content)
|
||||
else:
|
||||
print("Copy detected and removed (x4)")
|
||||
|
||||
image_check = copy.deepcopy(x5)
|
||||
x5 = requests.get(str5, headers=headerz)
|
||||
if x5.content != image_check.content:
|
||||
with chdir('Vanterm in gate'):
|
||||
if x5.status_code == 200:
|
||||
with open(image_name, 'wb') as f:
|
||||
f.write(x5.content)
|
||||
else:
|
||||
print("Copy detected and removed (x5)")
|
||||
|
||||
|
||||
image_check = copy.deepcopy(x6)
|
||||
x6 = requests.get(str6, headers=headerz)
|
||||
if x6.content != image_check.content:
|
||||
with chdir('Clark Drive overpass'):
|
||||
if x6.status_code == 200:
|
||||
with open(image_name, 'wb') as f:
|
||||
f.write(x6.content)
|
||||
else:
|
||||
print("Copy detected and removed (x6)")
|
||||
|
||||
|
||||
image_check = copy.deepcopy(x7)
|
||||
x7 = requests.get(str7, headers=headerz)
|
||||
if x7.content != image_check.content:
|
||||
with chdir('Columbia Container - crossing'):
|
||||
if x7.status_code == 200:
|
||||
with open(image_name, 'wb') as f:
|
||||
f.write(x7.content)
|
||||
else:
|
||||
print("Copy detected and removed (x7)")
|
||||
|
||||
|
||||
image_check = copy.deepcopy(x8)
|
||||
x8 = requests.get(str8, headers=headerz)
|
||||
if x8.content != image_check.content:
|
||||
with chdir('Terminal dock'):
|
||||
if x8.status_code == 200:
|
||||
with open(image_name, 'wb') as f:
|
||||
f.write(x8.content)
|
||||
else:
|
||||
print("Copy detected and removed (x8)")
|
||||
|
||||
|
||||
image_check = copy.deepcopy(x9)
|
||||
x9 = requests.get(str9, headers=headerz)
|
||||
if x9.content != image_check.content:
|
||||
with chdir('Commissioner truck staging'):
|
||||
if x9.status_code == 200:
|
||||
with open(image_name, 'wb') as f:
|
||||
f.write(x9.content)
|
||||
else:
|
||||
print("Copy detected and removed (x9)")
|
||||
|
||||
|
||||
image_check = copy.deepcopy(x10)
|
||||
x10 = requests.get(str10, headers=headerz)
|
||||
if x10.content != image_check.content:
|
||||
with chdir('Commissioner street overpass'):
|
||||
if x10.status_code == 200:
|
||||
with open(image_name, 'wb') as f:
|
||||
f.write(x10.content)
|
||||
else:
|
||||
print("Copy detected and removed (x10)")
|
||||
|
||||
image_check = copy.deepcopy(x1)
|
||||
|
||||
|
||||
print("Scanned")
|
||||
Reference in New Issue
Block a user