G
Guest
Hello,
I would like to know how to be able to filter out specific information on a
given website page irregardless if the content or formating of the webpage
changes.
I am retrieving the temperature, humidity, and dewpoint information from the
following website.
"http://text.weatheroffice.ec.gc.ca/forecast/city_e.html?qc-147&unit=m"
Right now with the code below if the temperature (value) information is not
in the same place following the Temperature match, it won't work any more.
Any help would be appreciated.
Regards,
Cannucci
PS: I have included the following code as a reference to my question.
// Get web page from Enviroment Canada site for the Montreal URL in text
mode.
Set req =
System.Net.WebRequest.Create("http://text.weatheroffice.ec.gc.ca/forecast/city_e.html?qc-147&unit=m");
Set response = req.GetResponse();
Set stream = response.GetResponseStream();
Set sr = CreateInstance("mscorlib", "System.IO.StreamReader", stream);
contents = sr.ReadToEnd();
// Use regular expression to find the Temperature Value for the Montreal
area.
Set lastmatch =
CreateInstance("System","System.Text.RegularExpressions.Regex","<dt>Temperature:</dt>\n <dd>((.|\n)*?)°");
Temp = lastmatch.Match(contents).Groups.Item(1).ToString();
Set lastmatch =
CreateInstance("System","System.Text.RegularExpressions.Regex","<dt>Humidity:</dt>\n <dd>((.|\n)*?)%");
Humidity = lastmatch.Match(contents).Groups.Item(1).ToString();
Set lastmatch =
CreateInstance("System","System.Text.RegularExpressions.Regex","<dt>Dew
Point:</dt>\n <dd>((.|\n)*?)°");
DewPoint = lastmatch.Match(contents).Groups.Item(1).ToString();
// Release the external resources
response.close();
sr.Close();
I would like to know how to be able to filter out specific information on a
given website page irregardless if the content or formating of the webpage
changes.
I am retrieving the temperature, humidity, and dewpoint information from the
following website.
"http://text.weatheroffice.ec.gc.ca/forecast/city_e.html?qc-147&unit=m"
Right now with the code below if the temperature (value) information is not
in the same place following the Temperature match, it won't work any more.
Any help would be appreciated.
Regards,
Cannucci
PS: I have included the following code as a reference to my question.
// Get web page from Enviroment Canada site for the Montreal URL in text
mode.
Set req =
System.Net.WebRequest.Create("http://text.weatheroffice.ec.gc.ca/forecast/city_e.html?qc-147&unit=m");
Set response = req.GetResponse();
Set stream = response.GetResponseStream();
Set sr = CreateInstance("mscorlib", "System.IO.StreamReader", stream);
contents = sr.ReadToEnd();
// Use regular expression to find the Temperature Value for the Montreal
area.
Set lastmatch =
CreateInstance("System","System.Text.RegularExpressions.Regex","<dt>Temperature:</dt>\n <dd>((.|\n)*?)°");
Temp = lastmatch.Match(contents).Groups.Item(1).ToString();
Set lastmatch =
CreateInstance("System","System.Text.RegularExpressions.Regex","<dt>Humidity:</dt>\n <dd>((.|\n)*?)%");
Humidity = lastmatch.Match(contents).Groups.Item(1).ToString();
Set lastmatch =
CreateInstance("System","System.Text.RegularExpressions.Regex","<dt>Dew
Point:</dt>\n <dd>((.|\n)*?)°");
DewPoint = lastmatch.Match(contents).Groups.Item(1).ToString();
// Release the external resources
response.close();
sr.Close();