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)) x11 = requests.get("https://ehub.portvancouver.com/Webcams/Photos/CameraDP_FS1?" + str(milliseconds)) x12 = requests.get("https://ehub.portvancouver.com/Webcams/Photos/DeltaportGate1?" + str(milliseconds)) x13 = requests.get("https://ehub.portvancouver.com/Webcams/Photos/DMSWest?" + str(milliseconds)) x14 = requests.get("https://ehub.portvancouver.com/Webcams/Photos/FSMainIntersection?" + str(milliseconds)) x15 = requests.get("https://ehub.portvancouver.com/Webcams/Photos/FSTruckInGate?" + str(milliseconds)) x16 = requests.get("https://ehub.portvancouver.com/Webcams/Photos/FSVACSGates?" + str(milliseconds)) x17 = requests.get("https://ehub.portvancouver.com/Webcams/Photos/FS5TrackCrossing?" + str(milliseconds)) x18 = requests.get("https://ehub.portvancouver.com/Webcams/Photos/PortsideNo8?" + str(milliseconds)) x19 = requests.get("https://ehub.portvancouver.com/Webcams/Photos/PortsideCoast2000?" + 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) str11 = "https://ehub.portvancouver.com/Webcams/Photos/CameraDP_FS1?" + str(milliseconds) str12 = "https://ehub.portvancouver.com/Webcams/Photos/DeltaportGate1?" + str(milliseconds) str13 = "https://ehub.portvancouver.com/Webcams/Photos/DMSWest?" + str(milliseconds) str14 = "https://ehub.portvancouver.com/Webcams/Photos/FSMainIntersection?" + str(milliseconds) str15 = "https://ehub.portvancouver.com/Webcams/Photos/FSTruckInGate?" + str(milliseconds) str16 = "https://ehub.portvancouver.com/Webcams/Photos/FSVACSGates?" + str(milliseconds) str17 = "https://ehub.portvancouver.com/Webcams/Photos/FS5TrackCrossing?" + str(milliseconds) str18 = "https://ehub.portvancouver.com/Webcams/Photos/PortsideNo8?" + str(milliseconds) str19 = "https://ehub.portvancouver.com/Webcams/Photos/PortsideCoast2000?" + 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(x11) x11 = requests.get(str11, headers=headerz) if x11.content != image_check.content: with chdir('Deltaport causeway'): if x11.status_code == 200: with open(image_name, 'wb') as f: f.write(x11.content) else: print("Copy detected and removed (x11)") image_check = copy.deepcopy(x12) x12 = requests.get(str12, headers=headerz) if x12.content != image_check.content: with chdir('Deltaport gate 1'): if x12.status_code == 200: with open(image_name, 'wb') as f: f.write(x12.content) else: print("Copy detected and removed (x12)") image_check = copy.deepcopy(x13) x13 = requests.get(str13, headers=headerz) if x13.content != image_check.content: with chdir('Delta truck staging'): if x13.status_code == 200: with open(image_name, 'wb') as f: f.write(x13.content) else: print("Copy detected and removed (x13)") image_check = copy.deepcopy(x14) x14 = requests.get(str14, headers=headerz) if x14.content != image_check.content: with chdir('Fraser Surrey main intersection'): if x14.status_code == 200: with open(image_name, 'wb') as f: f.write(x14.content) else: print("Copy detected and removed (x14)") image_check = copy.deepcopy(x15) x15 = requests.get(str15, headers=headerz) if x15.content != image_check.content: with chdir('Fraser Surrey in gate'): if x15.status_code == 200: with open(image_name, 'wb') as f: f.write(x15.content) else: print("Copy detected and removed (x15)") image_check = copy.deepcopy(x16) x16 = requests.get(str16, headers=headerz) if x16.content != image_check.content: with chdir('Fraser Surrey VACS gates'): if x16.status_code == 200: with open(image_name, 'wb') as f: f.write(x16.content) else: print("Copy detected and removed (x16)") image_check = copy.deepcopy(x17) x17 = requests.get(str17, headers=headerz) if x17.content != image_check.content: with chdir('Fraser Surrey track crossing'): if x17.status_code == 200: with open(image_name, 'wb') as f: f.write(x17.content) else: print("Copy detected and removed (x17)") image_check = copy.deepcopy(x18) x18 = requests.get(str18, headers=headerz) if x18.content != image_check.content: with chdir('PortsideBlundellNo.8 road intersection'): if x18.status_code == 200: with open(image_name, 'wb') as f: f.write(x18.content) else: print("Copy detected and removed (x18)") image_check = copy.deepcopy(x19) x19 = requests.get(str19, headers=headerz) if x19.content != image_check.content: with chdir('Portside road - westbound'): if x19.status_code == 200: with open(image_name, 'wb') as f: f.write(x19.content) else: print("Copy detected and removed (x19)") image_check = copy.deepcopy(x1) print("Scanned")