#!/usr/bin/perl
# a script to mirror space weather data by superkuh
# This is horribly disorganized, I know. It is a continual work in progress.
# Most off the data sources mirrored at in the below array/list, @urls.
# Because these will be named things like 33.png, refer to the comments
# for description and the source of http://superkuh.com/spaceweather/index.html
# for organization. 
#
# For data sources  with dynamic naming schemes I wrote a general function 
# grabdynamic() which takes 4 arguments: 
# page URL, image regex, base url for image, and resultant file name.
#
# For the particular website BASS2000 I needed to navigate an FTP that sometimes
# put images taken on day in the directory of the previous day. This, and their
# naming scheme made a slightly more complex function bass2000() necessary.
# it takes the 4 arguments:
# page URL, image regex, resultant file name, filename prefix, subtype
#
# Other times nothing works and I do a once-off custom script (like for stereo waves).
#
# Anyway, most URLs for the data mirrored are *somewhere* in this document.
# others are in:
#	http://superkuh.com/spaceweather_oncedaily.pl
#	http://superkuh.com/arforecastmovie.pl
#	http://superkuh.com/solisarmirror.pl
#
# ./spaceweather.pl &  ... will start from the first image in @urls
# ./spaceweather.pl 302 & ... will skip the first 302, starting at *303*.


use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
$ua->agent("Opera/9.80 (X11\; Linux x86_64\; U\; en) Presto/2.9.168 Version/11.50");
my @ns_headers = (
   'Accept' => 'image/gif, image/x-xbitmap, image/jpeg, 
        image/pjpeg, image/png, */*',
   'Accept-Charset' => 'iso-8859-1,*,utf-8',
   'Accept-Language' => 'en-US',
);

use LWP::Simple qw($ua get);
$ua->agent("Opera/9.80 (X11\; Linux x86_64\; U\; en) Presto/2.9.168 Version/11.50");

if ($ARGV[0] =~ /-+(h|help)/i) {
	print "## Spaceweather Aggregation Automator, scripted and collected by superkuh(.com)\n";
	print "normal run:\t\t \$ $0\n";
	print "start at 204th image:\t \$ $0 203\n";
	die "\n";
}


my $spacedirpath = 'home/superkuh/www/spaceweather';
my $useragent = "--user-agent=\"Opera/9.80 (X11\; Linux x86_64\; U\; en) Presto/2.9.168 Version/11.50\"";
my $delay = 30; #normal, no events
#my $delay = 2; #event going on, or testing

my @urls = ("http://gse.gi.alaska.edu/recent/vdp_recent.png",				#1 OLD DEAD GONE
 "http://www.swpc.noaa.gov/ace/Swepam_24h.gif",								#2
 "http://www.swpc.noaa.gov/ace/Mag_24h.gif",								#3
 "http://gse.gi.alaska.edu/recent/vdbs_recent.png",							#4 OLD DEAD GONE
 "http://www.swpc.noaa.gov/rt_plots/Xray_1m.gif",							#5
 "http://www.swpc.noaa.gov/rt_plots/SatEnv.gif",							#6
 "http://hesperia.gsfc.nasa.gov/rhessidatacenter/img/summary_plot_extmag.png", #7
 "http://hesperia.gsfc.nasa.gov/rhessidatacenter/img/smdi_maglc_fd.png",	#8
 "http://hesperia.gsfc.nasa.gov/rhessidatacenter/img/bbso_halph_fd.png",	#9
 "http://hesperia.gsfc.nasa.gov/rhessidatacenter/img/latest_solisMG.gif",	#10	
 "http://hesperia.gsfc.nasa.gov/rhessidatacenter/img/latest_solisCh.gif",	#11
 "ftp://solis.nso.edu/synoptic/level3/vsm/www_images/snsh.jpg",				#12
 "ftp://solis.nso.edu/synoptic/level3/vsm/www_images/chsm.jpg",				#13 this is replaced with something else
 "http://www.swpc.noaa.gov/pmap/gif/pmapN.gif",								#14
 "http://www.swpc.noaa.gov/pmap/gif/pmapS.gif",								#15
# "http://www.swpc.noaa.gov/rpc/costello/pkp_15m_7d.gif",					#16 old, deprecated
 "http://www.swpc.noaa.gov/wingkp/wingkp_15m_12h.gif",						#16 replacement, new index used
# "http://www.swpc.noaa.gov/rpc/costello/pkp_15m_24h.gif",					#17 old, deprecated
 "http://www.swpc.noaa.gov/wingkp/wingkp_15m_24h.gif",						#17 replacement, new index used
 "http://www.gedds.alaska.edu/HCS/Current.jpg",								#18
 "http://www.swpc.noaa.gov/ws/predplots/predveldaily_last29_3.png",			#19
 "http://helios.swpc.noaa.gov/ctipe/plots/CTIPeElectronDensity.png",		#20
 "http://sohowww.nascom.nasa.gov/data/realtime/c2/1024/latest.jpg",			#21
 "http://sohowww.nascom.nasa.gov/data/realtime/c3/1024/latest.jpg",			#22
 "http://sohowww.nascom.nasa.gov/data/realtime/eit_304/1024/latest.jpg",		#23
 'http://www.solen.info/solar/polarfields/polarfieldsfiltered.gif',		#24 solen.info solar polar B fields filtered
 "ftp://ftp.nso.edu/corona.maps/daily.scans.gif",							#25 corona map Fe lines
 "http://www.ips.gov.au/Images/Solar/Culgoora%20Observatory/Spectrographs/Real%20Time/realtime.gif", #26 18-1800Mhz
# "http://gbsrbs.nrao.edu/Data/Images/realtime_mini.png",					#27  10-100Mhz realtime
 'http://www.astro.umd.edu/~white/gb/Data/Images/realtime_mini.png',				#27  10-100Mhz realtime backup
 "http://sunbase.nict.go.jp/solar/denpa/todayreal.gif",						#28 10-2000Mhz realtime 5 min
 "ftp://ftp.nso.edu/corona.maps/fexiv.daily.gif",							#29 fe corona
 "ftp://ftp.nso.edu/corona.maps/fex.daily.gif",								#30 fe corona
 "ftp://ftp.nso.edu/corona.maps/fexiv.current.gif",							#31 fe disk
 "http://sidc.oma.be/images/latest_nsoHe.gif",								#32 HeI 10830Ã… (Kitt Peak)
 "http://web.ct.astro.it/sun/solec.jpg",									#33 photosphere
 "http://www.solen.info/solar/images/solar.gif",							#34 long term solar activity
 'http://sun.stanford.edu/~keiji/daily_mhd/slaltoday.new.jpg',				#35 coronal holes
# "ftp://solis.nso.edu/synoptic/level3/vsm/www_images/chsm.jpg",			#35 coronal holes
 'http://www.haarp.alaska.edu/data/spectrum2/data/last36_hf.gif',		#36 1-30Mhz 24 hours (newest) 
# "http://maestro.haarp.alaska.edu/data/spectrum2/data/latest_hf.gif",		#36 1-30Mhz 24 hours (old, not blocked) GONE, OLD
# 'http://maestro.haarp.alaska.edu/data/spectrum2/data/last36_hf.gif',		#36 1-30Mhz 24 hours new (blocked)
 'http://www.haarp.alaska.edu/data/spectrum2/data/last36_vhf.gif',		#37 100-200Mhz 24 hours (newest)
# "http://maestro.haarp.alaska.edu/data/spectrum2/data/latest_vhf.gif",		#37 100-200Mhz 24 hours (old, not blocked) GONE, OLD
# 'http://maestro.haarp.alaska.edu/data/spectrum2/data/last36_vhf.gif',		#37 100-200Mhz 24 hours (new, blocked)
 "http://137.229.36.30/haarp/imager/latest-4278.jpg",						#38 HAARP all-sky imager
 "http://137.229.36.30/haarp/imager/latest-5577.jpg",						#39 HAARP all-sky imager
 "http://137.229.36.30/haarp/imager/latest-6300.jpg",						#40 HAARP all-sky imager
 "http://137.229.36.30/haarp/imager/latest-9999.jpg",						#41 HAARP all-sky imager
 "http://www-star.stanford.edu/~vlf/hardware/fieldsites/alaska/juneau/latest.jpg", #42 ELF 0-5Khz (DEAD OLD DEAD 404)
 "http://eiger.physics.uiowa.edu/~vis/images/current.gif",				#43 polar aurora realtime image (OLD DEAD OLD)
 "http://gong2.nso.edu/dailyimages/img/hot-farside/gong_calib_farside.jpg",		#44 GONG farside mag
 "http://stereo-ssc.nascom.nasa.gov/beacon/beacon_insitu.gif",				#45 STEREO IMPACT and PLASTIC b-field and wind
 "http://stereo-ssc.nascom.nasa.gov/beacon/beacon_sep.gif",					#46 STEREO energetic particle
 "http://stereo-ssc.nascom.nasa.gov/beacon/beacon_swaves.gif",				#47 STEREO SWAVES KHz to MHz radio.
 "http://www.swpc.noaa.gov/rt_plots/XrayBL.gif",							#48 4 day GOES xray
 "http://gse.gi.alaska.edu/recent/recent_vel_001.png",						#49 MWO Source Surface Velocity (solar)
# "http://enternix.physik.uni-kiel.de/missions/soho/costep/realtime/forecast/cau_soho_costep_rt_forec_day.png", #50 proton flux SOHO/EPHIN (OLD OLD)
 'http://costep2.nascom.nasa.gov/forecast.png',						#50 proton flux SOHO/COSTEP/EPHIN
 'http://www.srl.utu.fi/erne_data/nrt/nrt_pictures/He2p.png',				#51 He to Proton ratio, ERNE on soho. (DEAD? domain missing)
 'http://www.leif.org/research/TSI-SORCE-2008-now.png',						#52 Recent solar activity (daily)
 'http://www.leif.org/research/F107%20at%20Minima%201954%20and%202008.png', #53 solar minima
 'http://neutronm.bartol.udel.edu/~pyle/thethplot2.gif', 					#54 Thule real time neutron
 'http://neutronm.bartol.udel.edu/~pyle/themcplot2.gif',					#55 Mc Murdo real time neutron
 'http://neutronm.bartol.udel.edu/~pyle/theplot2.gif', 						#56 Newark real time neutron
 'http://neutronm.bartol.udel.edu/~pyle/thefsplot2.gif', 					#57 Fort Smith real time neutron
 'http://neutronm.bartol.udel.edu/~pyle/theinplot2.gif', 					#58 Inuvik real time neutron
 'http://sidc.oma.be/images/latest_nsoCh.gif',								#59 CaII 8542Ã magnetogram (Kitt Peak)
 'http://helios.izmiran.troitsk.ru/lars/iflux.gif',							#60 25-270Mhz spectrogram 
 'http://w0.sao.ru/hq/sun/data/today/last_v.gif', 							#61 radio intensity multiwavelength
# "http://w0.sao.ru/hq/sun/data/today/last_i.gif", 
 "http://hinode.nao.ac.jp/latest/xrt_ffi_latest.gif",						#62 Hinode/XRT
 "http://sohowww.nascom.nasa.gov/data/realtime/eit_171/1024/latest.jpg", 	#63 SOHO EIT 171
 'http://seesproxy.tksc.jaxa.jp/fw/dfw/SEES/pub/ETS-VIII/MAM/GRAPH/ets8_mam_1week.jpeg', #64 JAXA/ETS-8 Sat Geomagnetic 
 "http://sidc.oma.be/images/latest_K_line.gif",								#65 CaII K spectroheliogram (Sac Peak)
 "http://umbra.nascom.nasa.gov/images/latest_K_line.gif",					#66 CaII K spectroheliogram (HAO Mauna Loa)
 "http://umbra.nascom.nasa.gov/eit/images/latest_eit_195_full.gif",			#67 SOHO EIT 195
 "http://umbra.nascom.nasa.gov/eit/images/latest_eit_284_full.gif",			#68 SOHO EIT 284
 "http://www.lmsal.com/forecast/sourcestrength.jpg",						#69 chromospheric magnetic source surface field
 "http://lasp.colorado.edu/sorce/total_solar_irradiance_plots/images/tim_level3_tsi_24hour_640x480.png", #70 TSI years
 "http://lasp.colorado.edu/sorce/total_solar_irradiance_plots/images/tim_level3_tsi_24hour_3month_640x480.png", #71 TSI months
 "http://nsosp.nso.edu/VIDEOIMG/isoon/latest_c.jpg",						#72 Continuum Subtracted He1083.0 nm
 "http://nsosp.nso.edu/VIDEOIMG/isoon/latest_hl.jpg",						#73 H-alpha (Limb Darkening Subtracted)
 "http://www.swpc.noaa.gov/rt_plots/Bou_12h.png",				#74 boulder ground magnometer
 "http://download.hao.ucar.edu/d5/www/fullres/latest/latest.chip.gif",		#75 hao He-I
 "http://download.hao.ucar.edu/d5/www/fullres/latest/latest.mk4.gif",		#76 K-corona
 "http://download.hao.ucar.edu/d5/www/fullres/latest/latest.limb.gif", 		#77 H-alpha limb
 "http://download.hao.ucar.edu/d5/www/fullres/latest/latest.disk.gif",		#78 H-alpha disk
 "http://download.hao.ucar.edu/d5/www/pspt.cak.gif",				#79 CaIIk (393 nm)
 "http://mlso.hao.ucar.edu/archive/acos/composites/latest_STEREOB-Mk4.jpg",	#80 stereo_b composite
 "http://mlso.hao.ucar.edu/archive/acos/composites/latest_SOHO-Mk4.jpg",	#81 soho composite
 "http://mlso.hao.ucar.edu/archive/acos/composites/latest_STEREOA-Mk4.jpg",	#82 stereo_a composite
 'http://sidc.oma.be/images/wnosuf.png',									#83 Sunspot north/south component long time period
 'http://maestro.haarp.alaska.edu/data/scmag/images/latest-Bx.gif',			#84 alaska magnometer spectrum x
 'http://maestro.haarp.alaska.edu/data/scmag/images/latest-By.gif',			#85 alaska magnometer spectrum Y
 'http://maestro.haarp.alaska.edu/data/scmag/images/latest-Bz.gif',			#86 alaska magnometer spectrum z
 'http://neutronm.bartol.udel.edu/~pyle/FracPlotLO.gif',					#87 cosmic rays realtime (neutron)
 'http://www.bartol.udel.edu/~takao/fig/GraphFrac.png',						#88 cosmic rays realtime (muon)
 'http://w0.sao.ru/hq/sun/data/today/last_m.gif',							#89 radio stokes parameters (http://w0.sao.ru/hq/sun/)
 'http://umtof.umd.edu/sem/SEM48HR_CH2CH4.GIF',								#90 soho/celias/sem 14 day xray
 'http://umtof.umd.edu/sem/SEM48HR_CH2.GIF',								#91 soho/celias/sem 3 day xray
 'http://umtof.umd.edu/sem/SEM4HR_CH2.GIF',									#92 soho/celias/sem 4 hour xray
 'http://umtof.umd.edu/pm/flare/flare48.gif',								#93 CELIAS/MTOF on SOHO proton 48 hour
 'http://umtof.umd.edu/pm/flare/flare_2week.gif',							#94 CELIAS/MTOF on SOHO proton 2 week
 'http://umtof.umd.edu/pm/latest2day.gif',									#95 ditto: Vel,Density,Angle Protons: 48 hour
 'http://umtof.umd.edu/pm/pm_2week.gif',									#96 ditto: ditto: 2 week 
 'http://www.astro.ucla.edu/~obs/images/cur_drw.jpg',						#97 Mt Wilson sunspot drawing (DEAD 500)
 'http://www.astro.ucla.edu/~obs/images/mpsi_recent.png',					#98 magnetic plage strength, Mt Wilson (DEAD 500)
 'http://www.swpc.noaa.gov/sxi/images/latest_goes15.png',					#99 GOES 15 xray imager
 'http://www.srl.utu.fi/erne_data/nrt/nrt_pictures/Proton3.png',		#100 SOHO COSTEP Proton flux/energy
 'http://pwg.gsfc.nasa.gov/windnrt/plot_files/Current_carrington.gif',		#101 WIND realtime http://pwg.gsfc.nasa.gov/windnrt/
 'http://spaceweather.inf.brad.ac.uk/images/flaremonitor.png',				#102 flare monitor http://spaceweather.inf.brad.ac.uk/monitor.html
 'http://lasp.colorado.edu/space_weather/dsttemerin/ACE_RT_Vtot_30_days.jpg',#103 ACE velocity 30 day
 'http://lasp.colorado.edu/space_weather/dsttemerin/ACE_RT_NP_30_days.jpg',	#104 ACE pressure 30 day
 'http://lasp.colorado.edu/space_weather/dsttemerin/ACE_RT_Bz_30_days.jpg',	#105 ACE B-field (Bz) 30 day
 'http://lasp.colorado.edu/space_weather/xlf3/xlf3.jpg',					#106 Daily averaged MeV electrons
 'http://lasp.colorado.edu/space_weather/dsttemerin/dst_combo.jpg',			#107 Predicted and actual Dst 30 day
 'http://lasp.colorado.edu/space_weather/dsttemerin/al_combo.jpg',			#108 Predicted and actual AL 30 day
 'http://rwc.lund.irf.se/rwc/dst/plot7d.png',								#109 predicted and real Dst from ACE data
 'ftp://laspftp.colorado.edu/pub/SEE_Data/plots/see_l3_daily_plot.png',		#110 TIMED/SEE irradiance spectrogram (3 day)
# 'http://www.arsc.edu/SpaceWeather/current.gif',						#111 realtime ionospheric currents (OLD)
 'http://spaceweather.arsc.edu/current.gif',							#111 realtime ionospheric currents (NEW, but stale)
 'http://pixie.spasci.com/DynMod/gifs/movie1.gif',							#112 realtime magnetosphere model animation
 'http://hinode.nao.ac.jp/latest/sot_ca_latest.gif',						#113 HINODE SOT CaII
 'http://hinode.nao.ac.jp/latest/sot_gb_latest.gif',						#114 HINODE SOT G-band
 'http://asc.harvard.edu/mta/mta_ace_plot_P3.gif',							#115 ACE EPAM scaled (proton) 3 days
 'http://www.swpc.noaa.gov/refm/plots/plot.png',							#116 relativistic electron forecasts (month)
 'http://www.ips.gov.au/Images/Solar/Solar%20Conditions/Solar%20Wind%20Speed/solarwind.gif',#117 Stereo A and B and ACE storm prediction
 'http://poes.ngdc.noaa.gov/data/plots/maps/png/recent/poes_recent_mep0e1_cylindrical.png',	#118 >30kV electrons earth map
 'http://geospace.nat.bg/swind.jpg',										#119 realtime magneopause sim.
 'http://sun.stanford.edu/~keiji/daily_mhd/swtoday.jpg',					#120 line-of-sight coronal density
 'http://soi.stanford.edu/magnetic/synoptic/eof/plots/synop.latest.gif',	#121 MDI synopti bfield - DEAD DEAD DEAD
 'http://soi.stanford.edu/magnetic/synoptic/nightly_images/latestmag.gif',	#122 MDI  magnetogram - DEAD DEAD DEAD
 'http://soi.stanford.edu/magnetic/synoptic/nightly_images/latestint.gif',	#123 MDI intensitygram - DEAD DEAD DEAD
 'ftp://ftpbass2000.obspm.fr/pub/latest_images/k3_col.jpg',					#124 Meudon Spectroheliogram K3 color
 'ftp://ftpbass2000.obspm.fr/pub/latest_images/hv_col.jpg',					#125 Hydrogen Alpha doppler
 'ftp://ftpbass2000.obspm.fr/pub/latest_images/kp_col.jpg',					#126 CLIMSO (?) CaK3
 'ftp://ftpbass2000.obspm.fr/pub/latest_images/wlc.jpg',					#127 meudon G-band 430.6nm
 'ftp://ftpbass2000.obspm.fr/pub/latest_images/cakc.jpg',			#128 meudon CaIIK heliograph color
 'http://w0.sao.ru/hq/sun/data/today/last_i.gif',				#129 SAO RATAN-600 1-D solar intensity
 'http://www.swpc.noaa.gov/ace/Sis_3d.gif',					#130 ACE SIS high energy protons 3 day
 'http://ccmc.gsfc.nasa.gov/idl_images/ccmc_vsw_RealTime.gif',				#131 Driving voltages, WINDMI
 'http://ccmc.gsfc.nasa.gov/idl_images/ccmc_results_RealTime_all.gif', 		#132 Magnetospheric Dst and AL indices, WINDMI
 'http://ccmc.gsfc.nasa.gov/ccmc-swrt-display/it/Weimer_3.png',				#133 northern hemisphere voltages
 'http://137.229.36.30/data/digisonde/LATEST.PNG',							#134 HARRP ionogram
 'http://moondog.astro.louisville.edu/today/flare.jpg',						#135 VLF Monitor Moor Observatory
 'http://www.vlf.it/last_E-VLF.jpg',										#136 VLF 
 'http://www.vlf.it/last-geomar.jpg',										#137 VLF and sesmic
 'http://www.irf.se/maggraphs/rtplot_flux2.png',							#138 Kiruna magnetogram
 'http://www.irf.se/riographs/rtkirplot2_rio.png',							#139 Kiruna riometer
 'http://www.irf.se/maggraphs/puls.png',									#140 Kiruna magnetic pulsation
 'http://www.irf.se/maggraphs/sgu1/lycksele.png',							#141 Lycksele magnetogram
 'http://www.irf.se/riographs/lyxtoday.png',								#142 Lycksele riometer
 'http://www.irf.se/~ionogram/ionogram/plots/mGifLy.gif',					#143 Lycksele ionogram
 'http://www.sbgo.se/magnetometer/mats.png',								#144 magnometer SBGO Stockholm
 'http://sidc.oma.be/cactus/out/detectionmap.png',							#145 Cactus CME detector synoptic 1 week
 'http://sidc.oma.be/cactus/scan/CME_and_SSN_rate.png',						#146 CME vs sunspot index long term
 'http://sol.spacenvironment.net/~spacewx/data/Jplot_Mg2_v3.png',			#147 SET MgII c/w Ratio http://www.spacewx.com/About_MgII.html
 'http://sol.spacenvironment.net/~caps_ops/current_files/forecast_index2.jpg',#148 Communication Alert and Prediction System
# 'http://sol.spacenvironment.net/~ionops/current_files/forecast_index2.jpg',#148 Communication Alert and Prediction System
 'http://sol.spacenvironment.net/~spacewx/data/e107_nowcast.jpg',			#149 integrated extreme ultraviolet flux from 1-105 nm
 'http://sol.spacenvironment.net/~spacewx/data/Jplot_Ap_v4.png',	#150 Geomagnetic ap Index with scales
 'http://sol.spacenvironment.net/~spacewx/data/current_UHFband_image.jpg',	#151 UHF Scintillation
 'http://terra1.spacenvironment.net/~gapops/GeoChargePlots/geo_charging0.jpg',#152 Geosynchronous deep charging (shaded)
 'http://terra1.spacenvironment.net/~gapops/GeoChargePlots/geo_charging1.jpg',#153 Geosynchronous deep charging (sunlight)
 'http://sol.spacenvironment.net/~caps_ops/current_files/Mewe_flare_spectrum.jpg.big.jpg',#154 flare XUV/EUV spectrum
 'http://sol.spacenvironment.net/~caps_ops/current_files/Xrays_5.jpg.big.jpg',#155 5 week flare outlook
 'http://sol.spacenvironment.net/~caps_ops/current_files/Xrays_18.jpg.big.jpg',#156 18 week flare outlook
 'http://terra1.spacenvironment.net/~xrayops/images/s2k_flare_history.jpg',	#157 obs. and predicted xray flares
 'http://terra1.spacenvironment.net/~xrayops/images/s2k_flare_predict.jpg', #158 Flare Evolution Prediction
 'http://geospace.nat.bg/test1.jpg',										#159 ionospheric electrostatic potential
 'ftp://laspftp.colorado.edu/pub/SEE_Data/plots/see_l3_daily_plot.png',		#160 TIMED SEE EUV 1-105 daily variance
 'http://lasp.colorado.edu/see/timeseries_png/latest_see_spwx.png',			#161 TIMED SEE EUV space weather plot
 'http://lasp.colorado.edu/see/timeseries_png/mission_egs_l2b_occ.png',		#162 TIMED SEE EUV global atmo. transmission
# below here not added to .awesome yet.
 'http://stereo-ssc.nascom.nasa.gov/beacon/latest/ahead_cor1_latest.jpg',	#163 STEREO A COR1
 'http://stereo-ssc.nascom.nasa.gov/beacon/latest/ahead_cor2_latest.jpg',	#164 STEREO A COR2
 'http://stereo-ssc.nascom.nasa.gov/beacon/latest/ahead_hi1_latest.jpg',	#165 STEREO A HI1
 'http://stereo-ssc.nascom.nasa.gov/beacon/latest/ahead_hi2_latest.jpg',	#166 STEREO A HI2
 'http://stereo-ssc.nascom.nasa.gov/beacon/latest/behind_cor1_latest.jpg',	#167 STEREO B COR1
 'http://stereo-ssc.nascom.nasa.gov/beacon/latest/behind_cor2_latest.jpg',	#168 STEREO B COR2
 'http://stereo-ssc.nascom.nasa.gov/beacon/latest/behind_hi1_latest.jpg',	#169 STEREO B HI1
 'http://stereo-ssc.nascom.nasa.gov/beacon/latest/behind_hi2_latest.jpg',	#170 STEREO B HI2
 'http://stereo-ssc.nascom.nasa.gov/beacon/latest/ahead_euvi_195_latest.jpg',#171 STREO A EUVI 195 latest beacon
 'http://forecast.izmiran.rssi.ru/img/XYZK_week.png',						#172 moscow magnetometer
 'http://www.leif.org/research/TSI-SORCE-Latest.png',						#173 leif total solar irradiance SORCE
 'http://www.ips.gov.au/Images/Solar/Learmonth%20Observatory/Radio%20Flux/rfluxplot.gif',#174 Learmonth radio daily
 'http://www.ips.gov.au/Images/Solar/Learmonth%20Observatory/Radio%20Flux/rfluxplot_hr.gif',#175 learnmonth hourly
 'http://proba2.sidc.be/swap/data/qlviewer/SWAPlatest.png',					#176 Proba-2 SWAP quicklook
 'http://www.lmsal.com/forecast/lastsynoptic.jpg',						#177 solarsoft magneotgram model
 'http://www.lmsal.com/forecast/windfit.gif',							#178 LMSAL/VSL solar wind model
 'http://www.lmsal.com/forecast/sourcestrengths.gif',					#179 LMSAL/VSL base field strength of IMF
 'http://www.lmsal.com/forecast/sourcepolarities.gif',					#180 LMSAL/VSL base field polarity of IMF
# SDO EVE is now operational! Still waiting for AIA and HMI data, though... 4/21/2010
 'http://lasp.colorado.edu/eve/data_access/quicklook/quicklook_data/L0CS/latest_level0cs.png',#181 SDO EVE level 0, 3 hour
 'http://lasp.colorado.edu/eve/data_access/quicklook/quicklook_data/latest_3day.png',#182 SDO EVE level 0, 3 day
 'http://www.swpc.noaa.gov/alerts/graphics/k-index.png',				#183 multi-site 3 hour K-indices
 'http://www.n3kl.org/sun/images/noaa_mag_3d.gif',						#184 GOES magnometer
 'http://www.n3kl.org/sun/images/noaa_elec_3d.gif',						#185 GOES electron flux
 'http://solwww.oma.be/users/dammasch/LyraSWClatest.gif',				#186 PROBA LYRA xray,6-20nm,17-80nm light curve
 'http://www.leif.org/research/WSO-Polar-Fields-since-2003.png',		#187 polar magnetic field strength
 'http://www2.nict.go.jp/y/y223/simulation/ion/images/nm.jpg',			#188 nict real-time ionsphere-thermosphere sim.
 'http://www2.nict.go.jp/y/y223/simulation/ion/images/n1.jpg',			#189 nict "" electhttp://cesar.kso.ac.at/sunspot_drawings/automatic/2010/ron density 120km sim.
 'http://www2.nict.go.jp/y/y223/simulation/ion/images/tc.jpg',			#190 nict "" total electron content sim.
 'http://www2.nict.go.jp/y/y223/simulation/ion/images/pt.jpg',			#191 nict "" electrical potential sim.
 'http://www2.nict.go.jp/y/y223/simulation/ion/images/q3.jpg',			#192 nict "" joule heating rate sim.
 'http://www2.nict.go.jp/y/y223/simulation/ion/images/r3.jpg',			#193 nict "" mass density change 300km
 'http://www2.nict.go.jp/y/y223/simulation/ion/images/t3.jpg',			#194 nict "" temperature change 300km
 'http://www2.nict.go.jp/y/y223/simulation/ion/images/u3.jpg',			#195 nict "" vertical velocity 300km
 'http://www2.nict.go.jp/y/y223/simulation/ion/images/o3.jpg',			#196 nict "" [N2+O2]/[O] change 300km
 'http://www2.nict.go.jp/aeri/swe/swx/ace/nnw/dst168.jpg',				#197 nict Dst prediction (neural network)
 'http://www2.nict.go.jp/aeri/swe/swx/ace/27day/aces.gif',				#198 nict solar wind map sim. 
 'http://gse.gi.alaska.edu/recent/ec2au/ecimf_1.png',					#199 ecliptic plane IMF 2 AU, DEAD OLD DEAD
 'http://gse.gi.alaska.edu/recent/ec10au/ecimf_1.png',					#200 ecliptic plane IMF 10 AU, DEAD OLD DEAD
 'http://lasp.colorado.edu/eve/data_access/quicklook/quicklook_data/latest_megsa.png',#201 SDO EVE MEGSA spectrogram 5-37nm
 'http://lasp.colorado.edu/eve/data_access/quicklook/quicklook_data/latest_megsb.png',#202 SDO EVE MEGSB spectrogram 35-105nm
 'http://lasp.colorado.edu/eve/data_access/quicklook/quicklook_data/latest_esp.png',#203 SDO EVE ESP 17-38 nm bands, 0.1-7 nm band
 'http://lasp.colorado.edu/eve/data_access/quicklook/quicklook_data/latest_esp_quad.png',#204 SDO EVE ESP Quad diode flare locator
 'http://aurorawatch.lancs.ac.uk/summary/aurorawatch_new/plots/crk/rolling.png',	#205 Crooktree, UK magneometer
# 'http://portal.cssdp.ca:8080/ssdp/static_content/ssdp/rt_oval/globe.gif',#206 old, SSDP real-time auroral oval
 'http://129.128.234.110:8080/ssdp/static_content/ssdp/rt_oval/globe.gif',#206 new, SSDP real-time auroral oval
 'http://www.spaceweather.gc.ca/generated_plots/fcstmap3.png',			#207 aurora map north america
 'http://www.spaceweather.gc.ca/generated_plots/ltfcst.png',			#208 27 day magnetic activity forcast
 'http://www.spaceweather.gc.ca/generated_plots/fluence.png',			#209 Forecast >2MeV Electron
 'http://aurora.phys.ucalgary.ca/data/ftp/anonymous/pub/data/themis/rt-mosaic/latest_ORTHO.jpg',#210 THEMIS real-time aurora
 'http://www.leif.org/research/Active%20Region%20Count.png',			#211 leif active region count
 'http://sdowww.lmsal.com/sdomedia/SunInTime/mostrecent/l0131.jpg',		#212 SDO AIA 
 'http://sdowww.lmsal.com/sdomedia/SunInTime/mostrecent/l0171.jpg',		#213 SDO AIA 
 'http://sdowww.lmsal.com/sdomedia/SunInTime/mostrecent/l0193.jpg',		#214 SDO AIA 
 'http://sdowww.lmsal.com/sdomedia/SunInTime/mostrecent/l0211.jpg',		#215 SDO AIA 
 'http://sdowww.lmsal.com/sdomedia/SunInTime/mostrecent/l0094.jpg',		#216 SDO AIA 
 'http://sdowww.lmsal.com/sdomedia/SunInTime/mostrecent/l0335.jpg',		#217 SDO AIA 
 'http://sdowww.lmsal.com/sdomedia/SunInTime/mostrecent/l1600.jpg',		#218 SDO AIA 
 'http://sdowww.lmsal.com/sdomedia/SunInTime/mostrecent/l1700.jpg',		#219 SDO AIA 
 'http://sdowww.lmsal.com/sdomedia/SunInTime/mostrecent/l4500.jpg',		#220 SDO AIA 
 'http://sdowww.lmsal.com/sdomedia/SunInTime/mostrecent/l0304.jpg',		#221 SDO AIA 
 'http://sdowww.lmsal.com/sdomedia/SunInTime/mostrecent/l_211_193_171.jpg',	#222 SDO AIA 
 'http://sdowww.lmsal.com/sdomedia/SunInTime/mostrecent/l_304_211_171.jpg',#223 SDO AIA
 'http://sdowww.lmsal.com/sdomedia/SunInTime/mostrecent/l_094_335_193.jpg',#224 SDO AIA
 'http://sidc.oma.be/images/combimap800.png',							#225 sidc oma active region map
 'http://lasp.colorado.edu/eve/data_access/quicklook/quicklook_data/L0CS/latest_sam.png',#226 SDO EVE SAM pinhole soft xray
 'http://www.monstein.de/solarflux/radio.png',							#227 610Mhz realtime 
 'http://sdowww.lmsal.com/sdomedia/SunInTime/mostrecent/l_HMImag_171.jpg',#228 SDO AIA _HMImag_171
 'http://sdowww.lmsal.com/sdomedia/SunInTime/mostrecent/l_HMImag.jpg',	#229 SDO AIA _HMImag
 'http://www2.nict.go.jp/y/y223/simulation/ion/images/q3s.jpg',			#230 southern pole aurora
 'http://sdowww.lmsal.com/sdomedia/SunInTime/mostrecent/aia_light_curves.gif',#231 SDO AIA lightcurves
 'http://gse.gi.alaska.edu/recent/recent_b.png',						#232 solar surface source magnetic field
 'http://www.swpc.noaa.gov/drap/Global.png',							#233 global D-region radio absorption
 'http://sdowww.lmsal.com/sdomedia/SunInTime/mostrecent/l_HMImagpfss.jpg',#234 SDO HMI pfss (DEAD 404 DEAD)
 'http://www2.nict.go.jp/y/y223/simulation/realtime/images/aeidx.jpg',	#235 NICT AL/AU and A0/AE
 'http://www.swpc.noaa.gov/wingkp/wingkp_15m_7d.gif',					#236 Wing K planetary index, 7 day
 'http://www.spaceweather.gc.ca/generated_plots/zonstackr.png',			#237 canadian zone auroral activity forcast
 'http://www.ips.gov.au/Images/Solar/Solar%20Conditions/Solar%20Wind%20Speed/solarwindmodel.jpg', #238 IPS solar wind
 'http://www.stp.isas.jaxa.jp/akebono/RDM/rdm/rdmflux2011.gif',			#239 rdmflux and kp
 'http://neutronm.bartol.udel.edu/~pyle/DIRPlot.gif',				#240 ACE MAG/SWEPAM Parker Spiral DIRPlot
 'http://www.swpc.noaa.gov/storm/RTSTORM.png',					#241 realtime ionospheric model
 'http://spaceweather.uma.es/result.gif',					#242 UMA proton flux >10MeV SEP
 'http://ips.ucsd.edu/slow/current/earth_skysnap_ecl_hammer_v.png',		#243 USCD Interplanetary Scintillation
 'http://ips.ucsd.edu/slow/current/earth_skysnap_ecl_hammer_g.png',		#244 USCD Interplanetary Scintillation
 'http://wso.stanford.edu/gifs/Tilts.gif',					#245 heliospheric current sheet tilt
 'http://wso.stanford.edu/SYNOP/prelim.pho.gif',				#246 photospheric mag. field
 'http://solar.uleth.ca/www/aurvis.gif',					#247 visibility of auroral activity
 'http://www.ips.gov.au/Images/Satellite/Satellite%20Environment/Electron%20Fluence%20Forecast/eflu.gif', #248 electron forcast
 'http://sd-www.jhuapl.edu/Aurora/ovation_live/je_north_latest_oval.png',	#249 OVATION north cap oval location
 'http://sd-www.jhuapl.edu/Aurora/ovation_live/je_south_latest_oval.png',	#250 OVATION south cap oval location
 'http://sd-www.jhuapl.edu/Aurora/ovation_live/flux_history.png',		#251 OVATION north cap oval flux history.
 'http://sd-www.jhuapl.edu/Aurora/ovation_live/kp_history.png',			#252 OVATION north cap Kp history.
 'http://www.ngdc.noaa.gov/stp/ovation_prime/data/north_nowcast_aacgm.png',	#253 OVATION-prime north cap location
 'http://www.ngdc.noaa.gov/stp/ovation_prime/data/south_nowcast_aacgm.png',	#254 OVATION-prime south cap location
 'http://previ.obspm.fr/hidden3/data/upload/chart.png',				#255 NMDB NEST neutron fluxes
 'http://cosmicrays.oulu.fi/webform/monitor.gif',				#256 Oulu neutron monitor
 'http://sgodata.sgo.fi/pub_pul/sodankyla_jpg/sod_pul_int_latest.jpg',		#257 Sodankyla magnetic pulsation
 'http://www.sgo.fi/Data/RealTime/Kuvat/magrtday.png',				#258 Sodankyla magnetogram
 'http://sdowww.lmsal.com/sdomedia/SunInTime/2011/07/19/l_HMImag.jpg',		#259 lower res SDO HMI mag line of sight
 'http://bdm.iszf.irk.ru/Current/daily_hol.gif',				#260 Irkutsk magnetic holes
 'http://bdm.iszf.irk.ru/Current/daily_r.gif',					#261 Irkutsk magnetic radial photosphere synoptic
 'http://bdm.iszf.irk.ru/Current/daily_ls.gif',					#262 Irkutsk magnetic line-of-sight photosphere synoptic
 'http://www.sepc.ac.cn/uploads/share0/J05/WORLD/SID_WORLD.jpg',		#263 SPCN.ac.cn Sudden Iono. Disturb. model
 'http://www.ips.gov.au/Images/Satellite/Ionospheric%20Scintillation/dwn_S4_latest.png', #264 Iono. Scintillation, Darwin, Aus
 'http://www.ips.gov.au/Images/Satellite/Ionospheric%20Scintillation/wei_S4_latest.png', #265 Iono. Scintillation, WEIPA, Aus
 'http://www.ips.gov.au/Images/Satellite/Ionospheric%20Scintillation/mac_S4_latest.png', #266 Iono. Scintillation, Macquarie, Aus
 'http://www.obs-nancay.fr/rh_realtime/0_itg.png',				#267 Nancay Radioheliograph 228 Mhz
 'http://www.obs-nancay.fr/rh_realtime/1_itg.png',				#268 Nancay Radioheliograph 298.7 Mhz
 'http://www.obs-nancay.fr/rh_realtime/2_itg.png',				#269 Nancay Radioheliograph 360.8 Mhz
 'http://www.obs-nancay.fr/rh_realtime/3_itg.png',				#270 Nancay Radioheliograph 327 Mhz
 'http://www.obs-nancay.fr/rh_realtime/4_itg.png',				#271 Nancay Radioheliograph 270.6 Mhz
 'http://www.obs-nancay.fr/rh_realtime/5_itg.png',				#272 Nancay Radioheliograph 445 Mhz
 'http://www.obs-nancay.fr/rh_realtime/6_itg.png',				#273 Nancay Radioheliograph 408 Mhz
 'http://www.obs-nancay.fr/rh_realtime/7_itg.png',				#274 Nancay Radioheliograph 150.9 Mhz
 'http://www.obs-nancay.fr/rh_realtime/8_itg.png',				#275 Nancay Radioheliograph 173.2 Mhz
 'http://www.obs-nancay.fr/rh_realtime/9_itg.png',				#276 Nancay Radioheliograph 432 Mhz
 'http://jsoc.stanford.edu/data/hmi/images/latest/HMI_latest_Int_1024x1024.gif',#277 SDO HMI Intensitygram
 'http://jsoc.stanford.edu/data/hmi/images/latest/HMI_latest_Dop_1024x1024.gif',#278 SDO HMI Dopplergram
 'http://solar.nro.nao.ac.jp/norh/html/daily/ifa_latest.png',			#279 Nobeyama Radioheliograph 17Ghz
 'http://umbra.gsfc.nasa.gov/images/latest_solisHe.gif',			#280 NSO SOLIS He I 10830 Å
 'http://iswa.gsfc.nasa.gov:8080/IswaSystemWebApp/iSWACygnetStreamer?timestamp=2038-01-23%2000:44:00&window=-1&cygnetId=289&.gif',#281 ISS Plasma
 'http://iswa.gsfc.nasa.gov:8080/IswaSystemWebApp/iSWACygnetStreamer?timestamp=2038-01-23%2000:44:00&window=-1&cygnetId=311&.gif',#282 Calipso Plasma
 'http://iswa.gsfc.nasa.gov:8080/IswaSystemWebApp/iSWACygnetStreamer?timestamp=2038-01-23%2000:44:00&window=-1&cygnetId=317&.gif',#283 Rax Plasma
 'http://iswa.gsfc.nasa.gov:8080/IswaSystemWebApp/iSWACygnetStreamer?timestamp=2038-01-23%2000:44:00&window=-1&cygnetId=49&.gif',#284 Aligned Plasma Overview
 'http://iswa.gsfc.nasa.gov:8080/IswaSystemWebApp/iSWACygnetStreamer?timestamp=2038-01-23%2000:44:00&window=-1&cygnetId=42&.gif',#285 BATSUS magnetosphere
 'http://swrl.njit.edu/current/char.png',					#286 NJIT Solar Filament Detection, Kanz Ha base image.
 'http://www.bbso.njit.edu/Images/daily/images/hfullc.jpg',			#287 BBSO Ha Contrast Enhanced Color
 'http://www.bbso.njit.edu/Images/daily/images/hfull2_kso.jpg',			#288 Kanzelhoehe Ha B/W Prominences too.
 'http://sw20.spaceweather.usu.edu/globalhfc/images/nvis_global.gif',		#289 Real-time HF radio propagation animation
 'http://www.monstein.de/solarflux/LightcurvesHB9SCT.png',			#290 e-Callisto radio curves
 'http://www.ips.gov.au/Images/Solar/Learmonth%20Observatory/Spectrographs/Real%20Time/realtime.gif', #291 Learmonth Radio Spectrograph
 'http://www.csun.edu/sfo/cf.gif',						#292 CFDT1 672nm San Fernado Observatory
 'http://www.csun.edu/sfo/kf.gif',						#293 CFDT1 Ca II K-line San Fernado Observatory
 'http://sw22.spaceweather.usu.edu/Images/gaimglobaltec.gif',			#294 USU Gauss-Markov GAIM Ionosphere TEC
 'http://sw22.spaceweather.usu.edu/Images/gaimnestack.gif',			#295 USU Gauss-Markov GAIM Ionosphere TEC per Height
 'http://sw22.spaceweather.usu.edu/Images/ifmglobaltec.gif',			#296 USU ? Ionosphere TEC
 'http://sw22.spaceweather.usu.edu/Images/ifmnestack.gif',			#297 USU ? Ionosphere TEC per Height
 'http://lasp.colorado.edu/eve/data_access/quicklook/quicklook_data/latest_eve_3day_xray.png', #298 SDO EVE 3 day Xray
 'http://lasp.colorado.edu/eve/data_access/quicklook/quicklook_data/latest_arjplot.png', #299 SDO EVE 3 day positional Xray
 'http://www.swpc.noaa.gov/ace/Epam_3d.gif',					#300 ACE EPAM proton/electron 3 day large
 'http://poes.ngdc.noaa.gov/data/plots/maps/png/recent/poes_recent_mep0p2_cylindrical.png', #301 POES 80-240KeV Protons 
 'http://iswa.gsfc.nasa.gov:8080/IswaSystemWebApp/iSWACygnetStreamer?timestamp=2038-01-23%2000:44:00&window=-1&cygnetId=301&.gif', #302 Hp Gigawatt
 'http://aurora.phys.ucalgary.ca/public/data/MSP/health/GILLAM_latest_image_data_summary.png', #303 Northstar Photometer Gillam
 'http://aurora.phys.ucalgary.ca/public/data/MSP/health/FSMITH_latest_image_data_summary.png', #304 Northstar Photometer Fort Smith
 'http://download.hao.ucar.edu/d5/dpm/raw_daily_image/latest.disk.gif',		#305 MLSO HAO HAlpha raw latest
 'http://www-sk.icrr.u-tokyo.ac.jp/realtimemonitor/skev.gif',			#306 Super-Kamiokande Realtime
 'http://www.ips.gov.au/Images/Solar/Solar%20Conditions/Solar%20Activity%20Plot/solplot.gif', #307 IPS solar activity graph
 'http://sdo.gsfc.nasa.gov/assets/img/latest/HMIFarsideMap.jpg',		#308 SDO HMI Calibrated Farside Map
 'http://iswa.gsfc.nasa.gov:8080/IswaSystemWebApp/iSWACygnetStreamer?timestamp=2038-01-23%2000:44:00&window=-1&cygnetId=81&.png',#309 WSA magnetic connectivity and solar wind velocity
 'http://www.swpc.noaa.gov/ws/predplots/predimfdaily_3.png',			#310 predicted and past IMF @ Earth.
 'http://www.swpc.noaa.gov/ws/predplots/predveldaily_3.png',			#311 predicted and past solar wind speed @ Earth
 'http://www3.kis.uni-freiburg.de/~chrotel/latest/recent_ca.jpg',		#312 ChroTel Ca II K full disk
 'http://www3.kis.uni-freiburg.de/~chrotel/latest/recent_he.jpg',		#313 ChroTel He I full disk
 'http://www3.kis.uni-freiburg.de/~chrotel/latest/recent_ha.jpg',		#314 ChroTel H alpha full disk
 'http://heastro.phys.lsu.edu/gbm/downloads/SUN_GBM_occ_fluxhist_auto.png',	#315 Fermi Solar Gammas from Earth Occultation
 'http://proteus.space.noa.gr/~srem/SEPF/plots/SREMHerschel_Last_Week_P_flux.png',#316 Hershel/SREM Proton Flux 7 day
 'http://proteus.space.noa.gr/~srem/SEPF/plots/SREMHerschel_2011_P_flux.png',	#317 Hershel/SREM Proton Flux 365 day
 'http://proteus.space.noa.gr/~srem/SEPF/plots/SREMPlanck_Last_Week_P_flux.png',#318 Planck/SREM Proton Fluxes 7 day
 'http://proteus.space.noa.gr/~srem/SEPF/plots/SREMPlanck_2011_P_flux.png',	#319 Planck/SREM Proton Fluxes 365 day
 'http://proteus.space.noa.gr/~srem/SEPF/plots/IREM_Last_Week_P_flux.png',	#320 INTEGRAL/SREM Proton Fluxes 7 day
 'http://proteus.space.noa.gr/~srem/SEPF/plots/IREM_2011_P_flux.png',		#321 INTEGRAL/SREM Proton Fluxes 365 day
 'http://swrl.njit.edu/ghn_web/latestimg/images/hfullbc_uset.jpg',		#322 Uccle Solar Equatorial Table Ha Full Disk
 'http://solarwww.mtk.nao.ac.jp/datatop/data02/latest/WL_latest.gif',		#323 JP White light fulldisk
 'http://solarwww.mtk.nao.ac.jp/datatop/data02/latest/Na_latest.gif',		#324 JP Na D line fulldisk
 'http://solarwww.mtk.nao.ac.jp/datatop/data02/latest/Ha_latest.gif', 		#325 JP Ha fulldisk
 'http://solarwww.mtk.nao.ac.jp/datatop/data02/latest/He_cI_latest.jpg',	#326 JP He 10830Å fulldisk
 'http://solarwww.mtk.nao.ac.jp/datatop/data02/latest/He_cV_latest.jpg',	#327 JP He 10830Å Stokes-V/I
 'http://solarwww.mtk.nao.ac.jp/datatop/data02/latest/Si_wV_latest.jpg',	#328 JP 10827Å Stokes-V/I
 'http://solarwww.mtk.nao.ac.jp/datatop/data02/latest/Fe_wV_latest.jpg',	#329 JP 15648Å Stokes-V/I,
 'http://home.deds.nl/~knol/sid.jpg',						#330 knol SID display
 'http://www.hida.kyoto-u.ac.jp/SMART/live/T1_latest_Ha-0.8_s.jpg',		#331 SMART Ha -0.8Angstrom fulldisk small 
 'http://www.hida.kyoto-u.ac.jp/SMART/live/T1_latest_Ha-0.5_s.jpg',		#332 SMART Ha -0.5Angstrom fulldisk small 
 'http://www.hida.kyoto-u.ac.jp/SMART/live/T1_latest_Ha+0.0_s.jpg',		#333 SMART Ha fulldisk small 
 'http://www.hida.kyoto-u.ac.jp/SMART/live/T1_latest_Ha+0.5_s.jpg',		#334 SMART Ha +0.5Angstrom fulldisk small 
 'http://www.hida.kyoto-u.ac.jp/SMART/live/T1_latest_Ha+0.8_s.jpg',		#335 SMART Ha +0.8Angstrom fulldisk small 
 'http://www.hida.kyoto-u.ac.jp/SMART/live/T1_latest_Ha+0.0_prom_s.jpg',	#336 SMART Ha prominences small 
 'http://www.hida.kyoto-u.ac.jp/SMART/live/T1_latest_Ha+3.5_s.jpg',		#337 SMART Ha +3.5Angstrom fulldisk small
 'http://www.phys.unm.edu/~lwa/lwatv/lwatv.png',				#338 Long Wave Array 74Mhz full sky realtime
 'http://helios.swpc.noaa.gov/ovation/images/Ovation_USA.png',			#339 Ovation Auroral Oval North America
 'http://helios.swpc.noaa.gov/ovation/images/Ovation_South.png', 		#340 Ovation Auroral Oval South Pole
 'http://www.bartol.udel.edu/~pyle/LossConeGraph.gif',				#341 Bartol Loss Cone Graph
 'http://www.bartol.udel.edu/~pyle/Four.gif',					#342 Bartol Neutron 1 minute
 'http://polaris.nipr.ac.jp/~acaurora/aurora/Tromso/latest.jpg'			#343 Tromso all-sky camera
);

my $startat_once;
my $startat;
my $totalurls = scalar(@urls);
if ($ARGV[0] =~ /\d+/) {
	$startat = $ARGV[0];
	$startat_once = 1;
	if ($startat >= $totalurls) {
		die "There only $totalurls URLS to skip. Put something at least one less, like " . ($totalurls - 1) .".\n";
	} else {
		print "Skipping the first $startat during the first loop.";
	}
} else {
	$startat = 0;
	$startat_once = 0;
}

while (1) { # I don't keep up the indenting, but everything else in this script is this while.
	my ($second, $minute, $hour, $dayofmonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = gmtime();
	my $year = 1900 + $yearOffset;
	my $shortyear = substr($year, -2);
	$month++;
	$month = sprintf("%02d",$month);
	$dayofmonth = sprintf("%02d",$dayofmonth);
	my $yesterday = sprintf("%02d",$dayofmonth-1);
	print "\nYear: $year, Month: $month, Day: $dayofmonth\n";
	print "\nMirroring the images...\n";
	print "-" x 80;
	print "\n";
	my $n = 1;		
	foreach my $url (@urls) {
	 if ($startat_once) {
	  if ($url eq $urls[$startat]) {
		$n = grab_spaceweather($url,$n);
		$startat_once = 0;
	  } else {
		$n++;
		next;
	  } #end startat if
	 } else {
		$n = grab_spaceweather($url,$n);
	 } #end startat_once if	
	} #end foreach @urls

	$startat_once = 0;

#sub TESTINGTHEFUCKOUTOFTHISSHIT {

# Moved to a once daily script to save bandwidth.
#
#`wget $useragent "http://iswa.gsfc.nasa.gov:8080/IswaSystemWebApp/iSWACygnetStreamer?timestamp=2038-01-23%2000:44:00&window=-1&cygnetId=40" --output-document=/$spacedirpath/magnetopause_standoff.gif`;
#`wget $useragent "http://iswa.gsfc.nasa.gov:8080/IswaSystemWebApp/iSWACygnetStreamer?timestamp=2038-01-23+00%3A44%3A00&window=-1&cygnetId=261" --output-document=/$spacedirpath/heliosphere_density.gif`;
#`wget $useragent "http://iswa.gsfc.nasa.gov:8080/IswaSystemWebApp/iSWACygnetStreamer?timestamp=2038-01-23+00%3A44%3A00&window=-1&cygnetId=263" --output-document=/$spacedirpath/heliosphere_velocity.gif`;
#`wget $useragent "http://iswa.gsfc.nasa.gov:8080/IswaSystemWebApp/iSWACygnetStreamer?timestamp=2038-01-23+00%3A44%3A00&window=-1&cygnetId=271" --output-document=/$spacedirpath/heliosphere_dynpressure.gif`;
# http://iswa.gsfc.nasa.gov:8080/IswaSystemWebApp/iSWACygnetStreamer?timestamp=2038-01-23%2000:44:00&window=-1&cygnetId=295 PFSS mag footprints
# http://iswa.gsfc.nasa.gov:8080/IswaSystemWebApp/iSWACygnetStreamer?timestamp=2038-01-23%2000:44:00&window=-1&cygnetId=315 Large TEC

# Recursion errors, commented out till I can figure out what the fuck is going on.

# Climso CaIIK
Bass2000("ftp://ftpbass2000.obspm.fr/pub/climso/Cak/$shortyear$month/",'climso_CaIIK.png', 'imoa_');
# Climso HeI Coronograph
Bass2000("ftp://ftpbass2000.obspm.fr/pub/climso/He/$shortyear$month/", "climso_h1_coronagraph.png", 'imoa_');
# Climso H Alpha coronograph
Bass2000("ftp://ftpbass2000.obspm.fr/pub/climso/Ha/$shortyear$month/", 'climso_halpha_coronagraph.png', 'imoa_', '06563_c1');
# Climso H Alpha
Bass2000("ftp://ftpbass2000.obspm.fr/pub/climso/Ha/$shortyear$month/", 'climso_halpha.png', 'imoa_', '06563_l1');
# Climso H Alpha coronograph + disc
Bass2000("ftp://ftpbass2000.obspm.fr/pub/climso/Ha/$shortyear$month/", 'climso_halpha_everything.png', 'imoa_', 'c1_l1');

# Nancay Radioheliograph 150.9MHz
Bass2000("ftp://ftpbass2000.obspm.fr/pub/nancay/164MHz/$shortyear$month/", "nancay_150point9Mhz.png", 'na');
# Nancay Radioheliograph 327.0Mhz
Bass2000("ftp://ftpbass2000.obspm.fr/pub/nancay/327MHz/$shortyear$month/", "nancay_327Mhz.png", 'nb');
# Nancay Decametric array spectra/polarization
Bass2000("ftp://ftpbass2000.obspm.fr/pub/decam/$shortyear$month/", "nancay_spectra.png", "S");

# Coimbra Spectroheliograph H Alpha dopplergram 
Bass2000("ftp://ftpbass2000.obspm.fr/pub/coimbra/dopp/$shortyear$month/", "coimbra_HAlphadoppler.jpg", "$shortyear$month");
# Coimbra Spectroheliograph CaII K3
Bass2000("ftp://ftpbass2000.obspm.fr/pub/coimbra/K3/$shortyear$month/", "coimbra_CaIIK3.jpg", "$shortyear$month");
# Coimbra Spectroheliograph CaII k1v
Bass2000("ftp://ftpbass2000.obspm.fr/pub/coimbra/K1/$shortyear$month/", "coimbra_CaIIK1v.jpg", "$shortyear$month");
# Coimbra Spectroheliograph H Alpha v continuum image
Bass2000("ftp://ftpbass2000.obspm.fr/pub/coimbra/cont/$shortyear$month/", "coimbra_HAlphav.jpg", "$shortyear$month");


# `wget $useragent \"\" --output-document=/$spacedirpath/`;
`wget $useragent \"http://flux.phys.uit.no/cgi-bin/mkstackplot.cgi?GifOnly&all=ALL+sites&comp=H&site=tro2a\" --output-document=/$spacedirpath/europemag.gif`;
sleep $delay;
`wget $useragent \"http://137.229.36.30/cgi-bin/riometer/riom2_plot.cgi?latest+36H+absorb+meas+qdc+log\" --output-document=/$spacedirpath/AKriometer.gif`;
sleep $delay;
`wget $useragent --no-check-certificate \"https://scinda.aer.com/haarp/tec/thumbnails/LATEST.PNG\" --output-document=/$spacedirpath/haarp_tec_latest.png`;
sleep $delay;
`wget $useragent --no-check-certificate \"http://137.229.36.30/cgi-bin/magnetometer/plotstations.cgi?latest+3D+500+KAK+FYU+EGL+DSC+COL+GAK+ANC+HOM+HDZ\" --output-document=/$spacedirpath/haarp_magnometerchain.png`;
sleep $delay;
# http://sidstation.loudet.org/01-graph/signal-level-graph.php?day=2011-08-09&channels=ch0&goes=goes15&sun=11_75&smooth&dummy=0.26641502852986576
`wget $useragent --no-check-certificate \"http://sidstation.loudet.org/01-graph/signal-level-graph.php?day=$year-$month-$yesterday&channels=ch0,ch3,ch5&goes=goes15&sun=11_75&smooth\" --output-document=/$spacedirpath/loudnet_19point58khz_SID_yesterday.png`;
sleep $delay;
`wget $useragent --no-check-certificate \"http://sidstation.loudet.org/01-graph/signal-level-graph.php?day=$year-$month-$dayofmonth&channels=ch0,ch3,ch5&goes=goes15&sun=11_75&smooth\" --output-document=/$spacedirpath/loudnet_19point58khz_SID_today.png`;
sleep $delay;
`wget $useragent --no-check-certificate \"http://sidstation.loudet.org/01-graph/emd-graph.php?day=$year-$month-$dayofmonth&channel=ch0&imf=4&maxdev=0.75&zoom\" --output-document=/$spacedirpath/loudnet_SID_EMD_today.png`;
sleep $delay;
`wget $useragent --no-check-certificate \"http://sidstation.loudet.org/01-graph/emd-graph.php?day=$year-$month-$yesterday&channel=ch0&imf=4&maxdev=0.75&zoom\" --output-document=/$spacedirpath/loudnet_SID_EMD_yesterday.png`;
sleep $delay;



# `wget $useragent --no-check-certificate \"\" --output-document=/$spacedirpath/`;

# http://sid.stanford.edu/database-browser/plot?starttime=2011-07-28T00.00.00&endtime=2011-07-29T00.00.00&res=1200x600&TZ=GMT&mss=true&sss=false&goes=true&goesFlareStrength=C1.0
my $sid = "http://sid.stanford.edu/database-browser/plot?starttime=$year-$month-" . sprintf("%02d",($dayofmonth - 1)) . "T00.00.00&endtime=$year-$month-$dayofmonth" . "T00.00.00&res=1280x800&TZ=GMT&mss=true&sss=false&goes=true&goesFlareStrength=C1.0";
`wget $useragent --no-check-certificate \"$sid\" --output-document=/$spacedirpath/SID_0.png`;
sleep $delay;

# Meudon Spectroheliogram Halpha
`wget $useragent --no-check-certificate \"ftp://ftpbass2000.obspm.fr/pub/latest_images/ha_col.jpg\" --output-document=/$spacedirpath/meudon_spectroheliogram_halpha.jpg`;
sleep $delay;
# Meudon Spectroheliogram Halpha prominences
`wget $useragent --no-check-certificate \"ftp://ftpbass2000.obspm.fr/pub/latest_images/hp_col.jpg\" --output-document=/$spacedirpath/meudon_spectroheliogram_halpha_prominences.jpg`;
sleep $delay;
# Meudon Spectroheliogram Kv1
`wget $useragent --no-check-certificate \"ftp://ftpbass2000.obspm.fr/pub/latest_images/k1_col.jpg\" --output-document=/$spacedirpath/meudon_spectroheliogram_kv1.jpg`;
sleep $delay;
# Meudon Calcium IIK 
`wget $useragent --no-check-certificate \"ftp://ftpbass2000.obspm.fr/pub/latest_images/cak.jpg\" --output-document=/$spacedirpath/meudonCaIIk.jpg`;
sleep $delay;
# Meudon Calcium IIh
`wget $useragent \"ftp://ftpbass2000.obspm.fr/pub/latest_images/cah.jpg\" --output-document=/$spacedirpath/meudonCaIIh.jpg`;
sleep $delay;
# Halpha ailes
`wget $useragent --no-check-certificate \"ftp://ftpbass2000.obspm.fr/pub/latest_images/hw_col.jpg\" --output-document=/$spacedirpath/ailes_halpha.jpg`;
sleep $delay;

# http://www.swpc.noaa.gov/alerts/warnings_timeline.html
# <IMG SRC="/alerts/graphics/warnings_timeline_30314.png" USEMAP="#Alert"
# <IMG SRC=\"\/alerts\/graphics\/(.+)\" USEMAP=\"\#Alert\"
grabdynamic('http://www.swpc.noaa.gov/alerts/warnings_timeline.html','<IMG SRC=\"\/alerts\/graphics\/(.+)\" USEMAP=\"\#Alert\"','http://www.swpc.noaa.gov/alerts/graphics/','NOAA_warnings.png');

# http://kopiko.ifa.hawaii.edu/ARMaps/today.html
# <DT><A HREF="/ARMaps/Today/20110802.1632_armap.png"><IMG SRC="
# <DT><A HREF=\"\/ARMaps\/Today\/(.+)\"><IMG SRC=\"
grabdynamic('http://kopiko.ifa.hawaii.edu/ARMaps/today.html','<DT><A HREF=\"\/ARMaps\/Today\/(.+)\"><IMG SRC=\"','http://kopiko.ifa.hawaii.edu/ARMaps/Today/','Mees_ARMap.png');

# Metsähovi Solar Observation Gallery - Callisto
# http://www.metsahovi.fi/callisto-gallery
# http://www.metsahovi.fi/en/sun/callisto/orig/?C=M;O=D
# alt=\"\[IMG\]\"><\/td><td><a href=\"(.+)\">cal
grabdynamic('http://www.metsahovi.fi/en/sun/callisto/orig/?C=M;O=D','alt=\"\[IMG\]\"><\/td><td><a href=\"(.+)\">cal','http://www.metsahovi.fi/en/sun/callisto/orig/','Metsahovi_Callisto.png');

# http://www.izmiran.ru/stp/lars/   # Solar Radio Laboratory
# http://www.izmiran.ru/stp/lars/archives/2011/
# <A HREF="s110801.jpg">s110801.jpg</A>\s+79k\s+<IMG SRC="/icons/text.gif" ALT="[TXT]"> <A HREF="s2011.htm">s2011.htm</A>
# <A HREF=\"(.+)\">s\d{6}\.jpg<\/A>\s+\d+\w+\s+<IMG SRC=\"\/icons\/text\.gif\" ALT=\"\[TXT\]\"> <A HREF=\"s\d\d\d\d\.htm\">s\d\d\d\d\.htm<\/A>
grabdynamic("http://www.izmiran.ru/stp/lars/archives/$year/",'<A HREF=\"(.+)\">s\d{6}\.jpg<\/A>\s+\d+\w+\s+<IMG SRC=\"\/icons\/text\.gif\" ALT=\"\[TXT\]\"> <A HREF=\"s\d\d\d\d\.htm\">s\d\d\d\d\.htm<\/A>',"http://www.izmiran.ru/stp/lars/archives/$year/",'IZMIRAN_LaRS.jpg');

# Metsähovi 37Ghz Solar Maps
# http://www.metsahovi.fi/solar-gallery
# http://www.metsahovi.fi/en/sun/maps/orig/?C=M;O=D
# alt=\"\[IMG\]\"><\/td><td><a href=\"(.+)\">sun
grabdynamic('http://www.metsahovi.fi/en/sun/maps/orig/?C=M;O=D','alt=\"\[IMG\]\"><\/td><td><a href=\"(.+)\">sun','http://www.metsahovi.fi/en/sun/maps/orig/','Metsahovi_37Ghz.png');

# Fermi Gamma Ray Bursts
# http://hesperia.gsfc.nasa.gov/fermi/gbm/qlook/daily_plots/2011/07/?C=M;O=D
# <a href="fermi_gbm_daily_rates_20110731.png">fermi_gbm_daily_rates_
# <a href=\"fermi_gbm_daily_rates_(.+)\">fermi_gbm_daily_rates_
grabdynamic("http://hesperia.gsfc.nasa.gov/fermi/gbm/qlook/daily_plots/$year/$month/?C=M;O=D",'<a href=\"fermi_gbm_daily_rates_(.+)\">fermi_gbm_daily_rates_',"http://hesperia.gsfc.nasa.gov/fermi/gbm/qlook/daily_plots/$year/$month/fermi_gbm_daily_rates_",'Fermi_GRB.png');

# http://hesperia.gsfc.nasa.gov/fermi/gbm/qlook/orbit_plots/2011/09/?C=M;O=D
# <a href="fermi_gbm_orbit_rates_20110927_230100.png">fermi_gbm_orbit_rates_
grabdynamic("http://hesperia.gsfc.nasa.gov/fermi/gbm/qlook/orbit_plots/$year/$month/?C=M;O=D",'<a href=\"(fermi_gbm_orbit_rates_.+\.png)\">fermi_gbm_orbit_rates_',"http://hesperia.gsfc.nasa.gov/fermi/gbm/qlook/orbit_plots/$year/$month/",'Fermi_GRB_RHESSI-time.png');

# http://www.solobskh.ac.at/index_en.php
grabdynamic('http://www.solobskh.ac.at/phokaD/JPEG/synoptic/2012/?M=D','<A HREF=\"kanz_bband_fd_(.+)\">','http://www.solobskh.ac.at/phokaD/JPEG/synoptic/2012/kanz_bband_fd_','kanz_continuum.jpg');
grabdynamic('http://www.solobskh.ac.at/caii/JPEG/synoptic/2012/?M=D','<A HREF=\"kanz_caiik_fd_(.+)\">','http://www.solobskh.ac.at/caii/JPEG/synoptic/2012/kanz_caiik_fd_','kanz_caIIk.jpg');

# Wind/Waves DAM, ARTEMIS, Nacay
# http://secchirh.obspm.fr/surweb/2011/1107/?C=M;O=D
# http://secchirh.obspm.fr/surweb/$year/$shortyear$month/?C=M;O=D
#alt="[IMG]"></td><td><a href="grc20120305_1500.png">grc20120305_1500.png</a>
#alt=\"\[IMG\]\"><\/td><td><a href=\"grc20120305_1500.png\">
#alt=\"\[IMG\]\"><\/td><td><a href=\"(\w{3}\d{8}_\d{4}.+\.png)\">
grabdynamic("http://secchirh.obspm.fr/surweb/$year/$shortyear$month/?C=M;O=D",'\"(\w{3}\d{8}_\d+\.png)\">',"http://secchirh.obspm.fr/surweb/$year/$shortyear$month/",'windwaves_DAM_ARTEMIS_Nancay.png');

# DAM, ARTEMIS, Nancay processed
# http://secchirh.obspm.fr/survey.php?hour=day&dayofyear=20110727&composite=3
# http://secchirh.obspm.fr/contweb/2011/1107/cont20110727.png
grabdynamic("http://secchirh.obspm.fr/contweb/$year/$shortyear$month/?C=M;O=D",'\"(\w{4}\d{8}\.png)\"',"http://secchirh.obspm.fr/contweb/$year/$shortyear$month/",'DAM_ARTEMIS_Nancay.png');

# http://iono.jpl.nasa.gov/latest_rti_global.html
# </h2>\n<img src="./RT/map20110724_161500.gif">
# </h2>\n<img src=\"\.\/RT\/(.+)\">
grabdynamic('http://iono.jpl.nasa.gov/latest_rti_global.html','</h2>\n<img src=\"\.\/RT\/(.+)\">','http://iono.jpl.nasa.gov/RT/','JPL_Iono_TEC.gif');

# http://sidc.oma.be/humain/survey.php
# <img src="data/callisto/survey/2011/07/23/GOESHUM_20110723_05.png" width="100%"/>
# <img src=\"data/callisto/survey/(.+)\" width=\"100%\"/>
grabdynamic('http://sidc.oma.be/humain/survey.php','<img src=\"data/callisto/survey/(.+)\" width=\"1','http://sidc.oma.be/humain/data/callisto/survey/','HumainRadio45-387Mhz_hours.png');

# http://sidc.oma.be/humain/realtime.php
# <img src="data/callisto/qkl/2011/07/23/HUMAIN_20110723_191458.png" /><br>
# <img src=\"data/callisto/qkl/(.+)\" \/><br>
grabdynamic('http://sidc.oma.be/humain/realtime.php','<img src=\"data/callisto/qkl/(.+)\" \/><br>','http://sidc.oma.be/humain/data/callisto/qkl/','HumainRadio45-387Mhz_minutes.png');

# http://eng.sepc.ac.cn/MBS.php
# <div id="view"><img src="http://www.sepc.ac.cn/uploads/share0/JCiCengDingCY/picture/2011/07/01/20110701220500.jpg" height="583px" width="680px" />
# <img src=\"http:\/\/www\.sepc\.ac\.cn\/uploads\/share0\/JCiCengDingCY\/picture\/(.+)\" height=\"583px\"
grabdynamic('http://eng.sepc.ac.cn/MBS.php','<img src=\"http:\/\/www\.sepc\.ac\.cn\/uploads\/share0\/JCiCengDingCY\/picture\/(.+)\" height=\"583px\"','http://www.sepc.ac.cn/uploads/share0/JCiCengDingCY/picture/','China_MagnetopauseBowShock.jpg');

# http://eng.sepc.ac.cn/ionosphere.php
# http://www.sepc.ac.cn/uploads/share3/SCINT_PLOT/2011/?M=D
# <IMG SRC="/icons/image2.gif" ALT="[IMG]"> <A HREF="000520110723_s.png">000520110723_s.png</A>
# ALT=\"[IMG]\"> <A HREF=\"(.+)\">
grabdynamic('http://www.sepc.ac.cn/uploads/share3/SCINT_PLOT/2011/?M=D','ALT=\"\[IMG\]\"> <A HREF=\"(.+)\">',"http://www.sepc.ac.cn/uploads/share3/SCINT_PLOT/$year/",'China_ScintPlot.png');

# <img align=bottom src="rtae_20110717.png">
# <img align=bottom src=\"(.+)\">
	grabdynamic('http://wdc.kugi.kyoto-u.ac.jp/ae_realtime/presentmonth/index.html','<img align=bottom src=\"(.+)\">','http://wdc.kugi.kyoto-u.ac.jp/ae_realtime/presentmonth/','ae_realtime.png');
 	# <IMG SRC=images/test_6.20091220091309.jpg><BR><BR>
	grabdynamic('http://www2.nict.go.jp/y/y223/simulation/realtime/',' <IMG SRC=images/(.+)><BR><BR>','http://www2.nict.go.jp/y/y223/simulation/realtime/images/','0.jpg');
	grabdynamic('http://www.solen.info/solar/','<img border=\"0\" src=\"images/(.+)\" width=\"512\"','http://www.solen.info/solar/images/','solen_activeregions.jpg');
	grabdynamic("http://cesar.kso.ac.at/sunspot_drawings/automatic/$year/?M=D","<A HREF=\"($year\\d{4}_\\d{4}.jpg)\">","http://cesar.kso.ac.at/sunspot_drawings/automatic/$year/",'kanzelhoehe_spot_circle.jpg');
#http://gong.nso.edu/data/magmap/mod4.html
# Carrington Rotation: 2091_126 &#160;&#160; 20 Dec 2009 08:04 UT<BR><IMG SRC="/data/magmap/QR/bq4/200912/mrbq4091220/mrbq4091220t0804c2091_126.gif" BORDER=1>
	grabdynamic('http://gong.nso.edu/data/magmap/mod4.html','<IMG SRC=\"(.+)\" BORDER=1>','http://gong.nso.edu','13.gif');
# <BR><IMG SRC="/data/magmap/QR/bq7/200912/mrbq7091220/mrbq7091220t1004c2091_125.gif" BORDER=1>
#http://gong.nso.edu/data/magmap/mod7.html
	grabdynamic('http://gong.nso.edu/data/magmap/mod7.html','<IMG SRC=\"(.+)\" BORDER=1>','http://gong.nso.edu','00.gif');

#http://swaves.gsfc.nasa.gov/data/s-waves-ds/2009/swaves_summary_20091221_c_s.png
#http://swaves.gsfc.nasa.gov/data/s-waves-ds/2009/swaves_summary_20091221_g.png
#grabdynamic('http://swaves.gsfc.nasa.gov/cgi-bin/wimp.pl','<div style=\"text-align: center\"> <img src=\"/data/s-waves-ds/(.+)\" /> </div>','http://swaves.gsfc.nasa.gov/data/s-waves-ds/','stereowaves.png');
	my $stereowaves = get("http://swaves.gsfc.nasa.gov/cgi-bin/wimp.pl");
		warn "get failed" if (!defined $stereowaves);
	if	($stereowaves =~ m#<div style=\"text-align: center\"> <img src=\"/data/s-waves-ds/(.+)\" /> </div>#) { 
			my $mixup = $1;
			$mixup =~ s/_g.png$/_c_s.png/;
			$stereowaves = 'http://swaves.gsfc.nasa.gov/data/s-waves-ds/' . $mixup;
			print "stereowaves: $stereowaves\n";
			`wget $useragent \"$stereowaves\" --output-document=/$spacedirpath/stereowaves.png`;
	} else {
		warn "It didn't match!\n";
	}
	sleep $delay;

	grabdynamic('http://solar.spacew.com/sunnow/','<IMG SRC=\"(.+)\" WIDTH=\"534\"','http://solar.spacew.com/sunnow/','ipsculgoora_1minute.jpg');
	#http://solar.nro.nao.ac.jp/norh/html/10min/realtime.html
	#<img src="/norh/html/10min/2009/12/21/ifa091221_062003.png">
	grabdynamic('http://solar.nro.nao.ac.jp/norh/html/10min/realtime.html','<img src=\"/norh/html/10min/(.+)\">','http://solar.nro.nao.ac.jp/norh/html/10min/','nobeyama17Ghz.png');
	grabdynamic('http://www.ssrt.org.ru/last.html','<a href=\"images/iv/(.+?)\">','http://www.ssrt.org.ru/images/iv/','SSRT5point76Ghz.png');
	# http://www.ssrt.org.ru/last.html
	# <a href="images/iv/v110714_0312.png">
	# <a href=\"images\/iv\/v(.+)\"><img border=\"0\" src=\"thumbs\/last-iv\/last_v.jpg\" \/>
	grabdynamic('http://www.ssrt.org.ru/last.html','<a href=\"images\/iv\/v(.+)\"><img border=\"0\" src=\"thumbs\/last-iv\/last_v.jpg\" \/>','http://www.ssrt.org.ru/images/iv/v','SSRT5point76Ghz_polarization.png');
	# http://www.spbf.sao.ru/cgi-bin/ion-p?page=rat_latest.ion
	grabdynamic('http://www.spbf.sao.ru/cgi-bin/ion-p?page=rat_latest.ion','<b>SSRT Intensity Image <\/b><br>\n\s<IMG ALT=\"ION Image\" WIDTH=\"512\" HEIGHT=\"512\" BORDER=\"1\" SRC=\"http://www.spbf.sao.ru/cgi-bin/ion-i\?(.+)\" NAME=\"Test\">','http://www.spbf.sao.ru/cgi-bin/ion-i?','SSRT5point76Ghz_lg.png');
	grabdynamic('http://www.spbf.sao.ru/cgi-bin/ion-p?page=rat_latest.ion','<b>RATAN-600 Data I & V<\/b><br>\n\s+<IMG ALT=\"ION Image\" WIDTH=\"512\" HEIGHT=\"512\" BORDER=\"1\" SRC=\"http://www.spbf.sao.ru/cgi-bin/ion-i\?(.+)\" NAME=\"Test\">','http://www.spbf.sao.ru/cgi-bin/ion-i?','RATAN600_IV.png');
	# http://www.spbf.sao.ru/cgi-bin/ion-p?page=rat1_weekly.ion
	grabdynamic('http://www.spbf.sao.ru/cgi-bin/ion-p?page=rat1_weekly.ion','<IMG ALT=\"ION Image\" WIDTH=\"400\" HEIGHT=\"400\" BORDER=\"1\" SRC=\"http://www.spbf.sao.ru/cgi-bin/ion-i\?(.+)\" NAME=\"Test1\">','http://www.spbf.sao.ru/cgi-bin/ion-i?','RATAN600_IV_2.png');
	# http://www.spbf.sao.ru/cgi-bin/ion-p?page=rat1_weekly.ion
	grabdynamic('http://www.spbf.sao.ru/cgi-bin/ion-p?page=rat1_weekly.ion','<b>3 <\/b><br>\n\s+<IMG ALT=\"ION Image\" WIDTH=\"400\" HEIGHT=\"400\" BORDER=\"1\" SRC=\"http://www.spbf.sao.ru/cgi-bin/ion-i\?(.+)\" NAME=\"Test\">','http://www.spbf.sao.ru/cgi-bin/ion-i?','RATAN600_IV_3.png');
	# http://www.spbf.sao.ru/cgi-bin/ion-p?page=rat1_weekly.ion
	grabdynamic('http://www.spbf.sao.ru/cgi-bin/ion-p?page=rat1_weekly.ion','<B>4 </B><BR>\n<IMG ALT=\"ION Image\" WIDTH=\"400\" HEIGHT=\"400\" BORDER=\"1\" SRC=\"http://www.spbf.sao.ru/cgi-bin/ion-i\?(.+)\" NAME=\"Test\">','http://www.spbf.sao.ru/cgi-bin/ion-i?','RATAN600_IV_4.png');
	#http://www.nwra.com/spawx/ssj4.html
	#<IMG SRC="qe_409533.gif" ALT="Picture" ALIGN = MIDDLE>
	grabdynamic('http://www.nwra.com/spawx/ssj4.html','<IMG SRC=\"(.+)\" ALT=\"Picture\"','http://www.nwra.com/spawx/','auroralQe.gif');
	#http://www.nwra.com/spawx/ssne24.html
	#<IMG SRC="ssne24_410605.gif" ALT="SSNe24 7-day plot" ALIGN = MIDDLE>
	grabdynamic('http://www.nwra.com/spawx/ssne24.html','<IMG SRC=\"(.+?)\" ALT=\"SSNe24 7-day plot\" ALIGN = MIDDLE>','http://www.nwra.com/spawx/','effectivesunspotnumber.gif');
	#<A HREF="/gif_summary/mag/smdi_maglc_fd_20100106_1647.gif">
	grabdynamic('http://mdisas.nascom.nasa.gov/health_mon/gif_mag_index.html','<A HREF=\"(.+)\">','http://mdisas.nascom.nasa.gov/','SOHO_MDI.gif');

	grabdynamic('http://fiji.sr.unh.edu/he_plus/?C=M;O=D', "<a href=\\\"(PLA_A_He_plus_monthly_$year$month+\\.png)\\\">", 'http://fiji.sr.unh.edu/he_plus/', 'Plastic_A_He_plus_monthly.png');
#	grabdynamic('http://fiji.sr.unh.edu/he_plus/?C=M;O=D', '<a href=\"(PLA_A_He_plus_monthly_.+\.png)\">', 'http://fiji.sr.unh.edu/he_plus/', 'Plastic_A_He_plus_monthly.png');
	grabdynamic('http://fiji.sr.unh.edu/he_plus/?C=M;O=D', "<a href=\\\"(PLA_B_He_plus_monthly_$year$month+\\.png)\\\">", 'http://fiji.sr.unh.edu/he_plus/', 'Plastic_B_He_plus_monthly.png');
#	grabdynamic('http://fiji.sr.unh.edu/he_plus/?C=M;O=D', '<a href=\"(PLA_B_He_plus_monthly_.+\.png)\">', 'http://fiji.sr.unh.edu/he_plus/', 'Plastic_B_He_plus_monthly.png');

#	grabdynamic('http://mcf.gsfc.nasa.gov/RB_nowcast/?M=D', '<A HREF=\"(.+_VLFwave.gif)\">.+_VLFwave.gif</A>', 'http://mcf.gsfc.nasa.gov/RB_nowcast/', 'VLFWave.gif');
	grabdynamic('http://mcf.gsfc.nasa.gov/RB_nowcast/', "<a href=\"($year" . "_$month" . "_T04_VLFwavecd.gif)\">$month/$year Wave</a><p>", 'http://mcf.gsfc.nasa.gov/RB_nowcast/', 'VLFWave.gif');
	grabdynamic('http://banana.ifa.hawaii.edu/Scint/scintplot.html','<img src=\"\/Scint\/(.+)\" align=center alt=\"GIF plot\">','http://banana.ifa.hawaii.edu/Scint/','solarscint_plot.png');
	grabdynamic('http://ccmc.gsfc.nasa.gov/cgi-bin/SWMF_RealTime_browse.cgi','<IMG SRC=\"/idl_images/(.+)\" alt=\"BATSRUS realtime overview plot\">','http://ccmc.gsfc.nasa.gov/idl_images/','Magnetosphere-Ionosphere.gif');
	grabdynamic('http://ccmc.gsfc.nasa.gov/cgi-bin/RTdisplay_SH_RA.cgi','img src=\"http://iswa.gsfc.nasa.gov:8080/IswaSystemWebApp/iSWACygnetStreamer\?(.+)\" alt=\"Solar wind input data\"','http://iswa.gsfc.nasa.gov:8080/IswaSystemWebApp/iSWACygnetStreamer?','LuhmanPFSSmagsource.gif');
	grabdynamic('http://ccmc.gsfc.nasa.gov/cgi-bin/RTdisplay_SH_RA.cgi','<img src=http://iswa.gsfc.nasa.gov:8080/IswaSystemWebApp/iSWACygnetStreamer\?(.+) alt=\"ENLIL solar wind spiral','http://iswa.gsfc.nasa.gov:8080/IswaSystemWebApp/iSWACygnetStreamer?','ENLILsolarwind.gif');
	grabdynamic('http://ccmc.gsfc.nasa.gov/cgi-bin/RTdisplay_SH_RA.cgi','img src=\"http://iswa.gsfc.nasa.gov:8080/IswaSystemWebApp/iSWACygnetStreamer\?(.+)\" alt=\"Solar wind input data\" height=580>','http://iswa.gsfc.nasa.gov:8080/IswaSystemWebApp/iSWACygnetStreamer?','WangSheeleyArgesourcesurface.gif');
	# http://www.solen.info/solar/poes/poes.html
	grabdynamic('http://www.solen.info/solar/poes/plot/?M=D','<A HREF=\"(poes_.+\.gif)\">','http://www.solen.info/solar/poes/plot/','solen_poes_north.gif');


	#http://themis.ssl.berkeley.edu/themisdata/overplots/2009/?C=M;O=D
	my $them1 = get("http://themis.ssl.berkeley.edu/themisdata/overplots/$year/?C=M;O=D"); #Get web page in content
		warn "get failed" if (!defined $them1);
	$them1 =~ /<a href=\"(\d\d+)\/\">/;
	my $month = $1;
	print "month: $month\n";
	my $them2 = get("http://themis.ssl.berkeley.edu/themisdata/overplots/$year/$month/?C=M;O=D");
		warn "get failed" if (!defined $them2);
	$them2 =~ /<a href=\"(\d\d+)\/\">/;
	my $themday = $1;
	print "day: $themday\n";
	my $them3 = get("http://themis.ssl.berkeley.edu/themisdata/overplots/$year/$month/$themday/?C=M;O=A");
		warn "get failed" if (!defined $them3);
	$them3 =~ /<a href="th(\w)_l2_overview_(.+?)\">/;
	#$them3 =~ /thd_l2_overview_(.+?)<\/a>/;
	my $image = $2;
	my $whichthemis = $1;
	print "image: $image\n";
	my $daystring = "\"http://themis.ssl.berkeley.edu/themisdata/overplots/" . "$year/$month/$themday/th$whichthemis" . "_l2_overview_$image" . "\" --output-document=/$spacedirpath/themisD.png";
	print "daystring: \"$daystring\"\n";
	`wget $useragent $daystring`;
	my $themAday = sprintf( "%.2d", ($themday));
	my $themApath = "http://themis.ssl.berkeley.edu/themisdata/overplots/$year/$month/$themAday/tha_l2_overview_$year$month$themAday" . "_0002.png";
	`wget $useragent \"$themApath\" --output-document=/$spacedirpath/themisA.png`;

my $timestamp = timestamp();
my $cmd = "wget $useragent \"http://iswa.gsfc.nasa.gov:8080/IswaSystemWebApp/CygnetSubResourceServlet?cygnetId=93&timestamp=$timestamp&parameter=93&subParameter=2&window=-1\" --output-document=/$spacedirpath/earth_mag_connection_sun.png";
`$cmd`;
sub timestamp {
	my @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
	my @weekDays = qw(Sun Mon Tue Wed Thu Fri Sat Sun);
	my ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = gmtime();
	my $year = 1900 + $yearOffset;
	$month++;
	my $timestamp = sprintf( "%4d-%02d-%02d %02d:%02d:%02d", $year,$month,$dayOfMonth,$hour,$minute,$second );
	return $timestamp; 
}

#} #END TESTINGTHEFUCKOUTOFTHISSHIT, skipping all dynamics.

} #END WHILE 1 								#grabdynamic('','','','');

#### NEW VERSION USING LWP::UserAgent
sub grab_spaceweather {
	my ($url, $n) = @_;
	$url =~ /(\.\w{1,4})$/;
	my $filetype = $1;

	$ua->default_header('Referer' => "$url");
	my $response = $ua->get("$url", @ns_headers);
	#my $hdrs = $response->headers->as_string();
	my $result = $response->status_line;
	my $content = $response->content();
	print ("$url - $result - $n\n");
	if ($result =~ /200/) {
		open (FILE, ">/$spacedirpath/$n$filetype") or warn "Could not open output!: $!";
		binmode (FILE);
		print FILE $content;
		close FILE;
		$n++;
		print "Sleeping $delay\n";
		sleep $delay;	
	} else {
		$n++;
		#next;
	}
	return $n;
}

#### NEW VERSION USING LWP::UserAgent
sub grabdynamic {
	my ($url, $regex, $baseurl, $outname) = @_;
	print "url: $url, regex: $regex, baseurl: $baseurl, outname: $outname\n";
 	my $response = $ua->get("$url", @ns_headers);
 	if ($response->is_success) {
		my $html = $response->decoded_content;
     		if	($html =~ m#$regex#i) {
			my $imgname = $1; 
			my $imgurl = $baseurl . $imgname;
			print "grabbing... $imgname from $imgurl\n";
			`wget $useragent \"$imgurl\" --output-document=/$spacedirpath/$outname`;
		} else {
			warn "It didn't match!";
		}
 	} else {
     		warn $response->status_line;
 	}
	sleep $delay;
}

sub Bass2000 {
	my ($url, $outname, $prefix, $subtype, $count) = @_;
	my $imgname;
	my $noinfiniteloop;
	$noinfiniteloop = $count if $count;
	#print "\nurl: $url, outname: $outname, prefix: $prefix, subtype: $subtype\n";
	my $response = $ua->get("$url", @ns_headers);
	if ($response->is_success) {
		my $html = $response->decoded_content;
		if ($subtype) {
			my @files = split("\n", $html);
			my @filesubtype;
			foreach my $file (@files) {
				#print "file: $file\n";
				if ($file =~ /$subtype/) {
					push(@filesubtype, $file);
				}
			}
			my $latestfile = pop(@filesubtype);
			$latestfile =~ /($prefix.+)/;
			$imgname = $1;
	
		} else {
			my @files = split("\n", $html);
			my $latestfile = pop(@files);
			$latestfile =~ /($prefix.+)/;
			$imgname = $1;
			#print "total: " . scalar(@files) . " \nlatest: $latestfile\nFile: $imgname\n"; 
		}
		my $imgurl;
		if ($imgname) {
			$imgurl = $url . $imgname;
			print "grabbing... $imgname from $imgurl\n";
			#`wget $useragent \"$imgurl\" --output-document=/$spacedirpath/$outname`;

			$ua->default_header('Referer' => "$url");
 			my $response = $ua->get("$imgurl", @ns_headers);
			my $result = $response->status_line;
			my $content = $response->content();
			print ("$imgurl - $result\n");
			if ($result =~ /200/) {
				open (FILE, ">/$spacedirpath/$outname") or warn "Could not open output!: $!";
				binmode (FILE);
				print FILE $content;
				close FILE;
				print "Sleeping $delay\n";
				sleep $delay;	
			} else {
				print "failure, bad http response. no sleep for the wicked.\n";
			}	
		} else {

sub ISuckAtProgrammingDontDoThis {

			next if $noinfiniteloop;
			$noinfiniteloop = 1;
			print "failure: no image match for \"$imgname\". trying previous month\'s directory\n";
			# on the 1st of the month not yet moved to new month directory. Try this:
			if ($month == 01) {
				my $prevshortyear = $shortyear - 1;
				if ($prefix eq "$shortyear$month") {
					$prefix = "$prevshortyear" . "12";
				}
				my $tempurldate = $prevshortyear . "12";
				$url =~ s#/$shortyear$month/$#/$tempurldate/#;
				print "\n$url, $outname, $prefix, $subtype, $noinfiteloop\n";
				Bass2000($url, $outname, $prefix, $subtype, $noinfiteloop);
			} else {
				if ($prefix eq "$shortyear$month") {
					$prefix = "$shortyear" . sprintf("%02d",($month-1));
				}
				my $tempurldate = $shortyear . sprintf("%02d",($month-1));
				$url =~ s#/$shortyear$month/$#/$tempurldate/#;
				Bass2000($url, $outname, $prefix, $subtype, $noinfiteloop);
			}
}

		}

	} else {
		print "\n\nWTF?! Uh, I didn't download the index listing?\n\n";
	}
}

#sub Bass2000_old {
#	my ($url, $outname, $prefix, $subtype) = @_;
#	my $imgname;
	#print "\nurl: $url, outname: $outname, prefix: $prefix, subtype: $subtype\n";
#	my $response = $ua->get("$url", @ns_headers);
#	if ($response->is_success) {
#		my $html = $response->decoded_content;
#		if ($subtype) {
#			my @files = split("\n", $html);
#			my @filesubtype;
#			foreach my $file (@files) {
				#print "file: $file\n";
#				if ($file =~ /$subtype/) {
#					push(@filesubtype, $file);
#				}
#			}
#			my $latestfile = pop(@filesubtype);
#			$latestfile =~ /($prefix.+)/;
#			$imgname = $1;
	
#		} else {
#			my @files = split("\n", $html);
#			my $latestfile = pop(@files);
#			$latestfile =~ /($prefix.+)/;
#			$imgname = $1;
			#print "total: " . scalar(@files) . " \nlatest: $latestfile\nFile: $imgname\n"; 
#		}
#		my $imgurl = $url . $imgname;
#		print "grabbing... $imgname from $imgurl\n";
#		`wget $useragent \"$imgurl\" --output-document=/$spacedirpath/$outname`;
#	} else {
#		print "\n\nWTF?! Uh, I didn't download the index listing?\n\n";
#	}
#	sleep $delay;
#}

#### OLD VERSION USING LWP::Simple
#sub grabdynamic {
#	# $ua->agent("Opera/9.80 (X11\; Linux x86_64\; U\; en) Presto/2.9.168 Version/11.50");
#	my ($url, $regex, $baseurl, $outname) = @_;
#	print "url: $url, regex: $regex, baseurl: $baseurl, outname: $outname\n";
#	my $html = get("$url"); #Get web page in content
#		warn "get failed" if (!defined $html);
#	if	($html =~ m#$regex#) {
#			my $imgname = $1; 
#			my $imgurl = $baseurl . $imgname;
#			print "grabbing... $imgname from $imgurl\n";
#			`wget $useragent \"$imgurl\" --output-document=/$spacedirpath/$outname`;
#	} else {
#		warn "It didn't match!";
#	}
#	sleep $delay;
#}


sub mirrorimages {
	#my $path = shift if $_[0] m#/#;
	my $path = shift;
	my @urls = @_;
	my $n = 1;		
	foreach my $url (@urls) {
		$url =~ /(\.\w{1,4})$/;
		my $filetype = $1;
		`wget $useragent \"$url\" --output-document=/$spacedirpath/$path$n$filetype`;
		$n++;
	}
}

sub forlater {
	my $startat;
	if ($ARGV[0] =~ /\d+/) {
		$startat = $ARGV[0];
	} else {
		$startat = 0;
	}
}
