Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,7 @@ import datetime
|
|
| 10 |
import urllib.request
|
| 11 |
import uuid
|
| 12 |
import os
|
| 13 |
-
print(os.system('pip freeze'))
|
| 14 |
main_directory = "https://services.swpc.noaa.gov/"
|
| 15 |
sdo_source = "https://sdo.gsfc.nasa.gov/assets/img/browse/"
|
| 16 |
sdo_source_format = "https://sdo.gsfc.nasa.gov/assets/img/browse/YEAR/MONTH/DAY/DATE_IDENT_SIZE_TOOL.jpg"
|
|
@@ -157,7 +157,7 @@ def make_tree(url1="",url2="",url3="",url4="",url5="",url6="",url7="",url8=""):
|
|
| 157 |
spl = feed1.text.split("href=")
|
| 158 |
for line in spl:
|
| 159 |
spl2 = line.split(">")[0]
|
| 160 |
-
print(spl2)
|
| 161 |
if spl2.endswith('/"') or spl2.endswith('.json"') or spl2.endswith('.png"') or spl2.endswith('.gif"') or spl2.endswith('.jpg"'):
|
| 162 |
fin=line.split(">")[0].strip('""')
|
| 163 |
link_box.append(fin)
|
|
@@ -174,7 +174,7 @@ def get_images():
|
|
| 174 |
for line in spl:
|
| 175 |
spl2 = line.split(">")[0].strip('""')
|
| 176 |
if spl2.endswith(".png") or spl2.endswith(".gif") or spl2.endswith(".jpg"):
|
| 177 |
-
print(spl2)
|
| 178 |
html_out+=f'<div class="img_class"><a href="{get_url}{spl2}" target="_blank">{spl2}</a><br><img src={get_url}{spl2}></div>'
|
| 179 |
else:
|
| 180 |
print(spl2)
|
|
@@ -184,7 +184,7 @@ def get_images():
|
|
| 184 |
for line2 in spl:
|
| 185 |
spl2 = line2.split(">")[0].strip('""')
|
| 186 |
if spl2.endswith(".png") or spl2.endswith(".gif") or spl2.endswith(".jpg"):
|
| 187 |
-
print(spl2)
|
| 188 |
html_out+=f'<div class="img_class"><a href="{get_url2}{spl2}" target="_blank">{spl2}</a><br><img src={get_url2}{spl2}></div>'
|
| 189 |
else:
|
| 190 |
print(spl2)
|
|
@@ -329,6 +329,7 @@ def nasa_sdo_images(obj,size,date1,date2):
|
|
| 329 |
if "All" in obj:
|
| 330 |
obj = sdo_obj
|
| 331 |
link_box=[]
|
|
|
|
| 332 |
# Parse the HTML content using BeautifulSoup
|
| 333 |
soup = bs4.BeautifulSoup(feed1.content, 'html.parser')
|
| 334 |
#print(soup)
|
|
@@ -344,15 +345,16 @@ def nasa_sdo_images(obj,size,date1,date2):
|
|
| 344 |
for o in obj:
|
| 345 |
for s in size:
|
| 346 |
ls=href.split("_")
|
| 347 |
-
print(ls[1][0:4])
|
| 348 |
-
print(date1[8:13])
|
| 349 |
if ls[1][0:4]>=date1[8:13]:
|
| 350 |
src_obj=ls[3].split('.jpg')[0]
|
| 351 |
if src_obj == o:
|
| 352 |
if int(ls[2]) == int(s):
|
|
|
|
| 353 |
html_in+=f'<div class="img_class_sdo"><a href="{sdo_source_format}{href}" target="_blank">{href}</a><br><img src={sdo_source_format}{href}></div>'
|
| 354 |
html_in+="</div>"
|
| 355 |
-
return html_in,
|
| 356 |
|
| 357 |
def get_concat_h_cut(in1, in2):
|
| 358 |
uid=uuid.uuid4()
|
|
|
|
| 10 |
import urllib.request
|
| 11 |
import uuid
|
| 12 |
import os
|
| 13 |
+
#print(os.system('pip freeze'))
|
| 14 |
main_directory = "https://services.swpc.noaa.gov/"
|
| 15 |
sdo_source = "https://sdo.gsfc.nasa.gov/assets/img/browse/"
|
| 16 |
sdo_source_format = "https://sdo.gsfc.nasa.gov/assets/img/browse/YEAR/MONTH/DAY/DATE_IDENT_SIZE_TOOL.jpg"
|
|
|
|
| 157 |
spl = feed1.text.split("href=")
|
| 158 |
for line in spl:
|
| 159 |
spl2 = line.split(">")[0]
|
| 160 |
+
#print(spl2)
|
| 161 |
if spl2.endswith('/"') or spl2.endswith('.json"') or spl2.endswith('.png"') or spl2.endswith('.gif"') or spl2.endswith('.jpg"'):
|
| 162 |
fin=line.split(">")[0].strip('""')
|
| 163 |
link_box.append(fin)
|
|
|
|
| 174 |
for line in spl:
|
| 175 |
spl2 = line.split(">")[0].strip('""')
|
| 176 |
if spl2.endswith(".png") or spl2.endswith(".gif") or spl2.endswith(".jpg"):
|
| 177 |
+
#print(spl2)
|
| 178 |
html_out+=f'<div class="img_class"><a href="{get_url}{spl2}" target="_blank">{spl2}</a><br><img src={get_url}{spl2}></div>'
|
| 179 |
else:
|
| 180 |
print(spl2)
|
|
|
|
| 184 |
for line2 in spl:
|
| 185 |
spl2 = line2.split(">")[0].strip('""')
|
| 186 |
if spl2.endswith(".png") or spl2.endswith(".gif") or spl2.endswith(".jpg"):
|
| 187 |
+
#print(spl2)
|
| 188 |
html_out+=f'<div class="img_class"><a href="{get_url2}{spl2}" target="_blank">{spl2}</a><br><img src={get_url2}{spl2}></div>'
|
| 189 |
else:
|
| 190 |
print(spl2)
|
|
|
|
| 329 |
if "All" in obj:
|
| 330 |
obj = sdo_obj
|
| 331 |
link_box=[]
|
| 332 |
+
out_box=[]
|
| 333 |
# Parse the HTML content using BeautifulSoup
|
| 334 |
soup = bs4.BeautifulSoup(feed1.content, 'html.parser')
|
| 335 |
#print(soup)
|
|
|
|
| 345 |
for o in obj:
|
| 346 |
for s in size:
|
| 347 |
ls=href.split("_")
|
| 348 |
+
#print(ls[1][0:4])
|
| 349 |
+
#print(date1[8:13])
|
| 350 |
if ls[1][0:4]>=date1[8:13]:
|
| 351 |
src_obj=ls[3].split('.jpg')[0]
|
| 352 |
if src_obj == o:
|
| 353 |
if int(ls[2]) == int(s):
|
| 354 |
+
out_box.append(f'{sdo_source_format}{href}')
|
| 355 |
html_in+=f'<div class="img_class_sdo"><a href="{sdo_source_format}{href}" target="_blank">{href}</a><br><img src={sdo_source_format}{href}></div>'
|
| 356 |
html_in+="</div>"
|
| 357 |
+
return html_in, out_box
|
| 358 |
|
| 359 |
def get_concat_h_cut(in1, in2):
|
| 360 |
uid=uuid.uuid4()
|