c# how can i parse json form html page

  • Thread starter Thread starter elfenliedtopfan2
  • Start date Start date
E

elfenliedtopfan2

Guest
ok i tryied useing regex and wasted like 4 hours of my time trying to get it to work ( it dont haha ) but the issue i having is this string is all one line

json in html example

and what im trying to do is parse out the name > ( value here )
and then parse out the witch and hight <values here )

and then finnaly if the hight and width match 2048 or 4095 then it will find the link and download the image

but the issue is i never touched on json i made a regex for the patten of the whole block of code but of corse regex and c# really dont get along well as i found the hard way

WebClient elftestweb = new WebClient();
String searchquery = "KP/-31 Submachine Gun - Buy Royalty Free 3D model by Luchador (@Luchador90)";
String scrapdata;
scrapdata = elftestweb.DownloadString(searchquery);
//(&#[0-9]+;[a-z]+&#[0-9]+;:\s[0-9]+\},\s{)
MatchCollection fullregex = Regex.Matches(scrapdata, @"(&#[0-9]+;[a-zA-Z]+&#[0-9]+;:\s&#[0-9]+;[0-9]+-[0-9]+-[0-9]+[A-Z0-9a-z]+:[0-9]+:[0-9]+.[0-9]+&#[0-9]+;\}\],\s&#[0-9]+;[a-zA-Z]+&#[0-9]+;:\s&#[0-9]+;[a-z]+&#[0-9]+)", RegexOptions.Singleline);
foreach (Match elfmatch in fullregex)
{
String elftestparse = elfmatch.Groups[1].Value;

MessageBox.Show(elftestparse.ToString());


}


thats the code i currently have and the regex but it just skips right past and dont go in yet it shows fine in notepad++ but c# seems to have troble with it i also tryied htmlaglility pack and got same of of problem but the string is all one lone so i not sure why i cant get the values i need but hopefully someone can shed some light on it for me

thank you in advance elfenliedtopfan5

Continue reading...
 
Back
Top