I need to extract certain data from a website.
I have watched this youtube video https://www.youtube.com/watch?v=rru3G7PLVjw and roughly have a sense of how to code it.
Basically what i want to do is to extract and store (the radio button text) Very easy!,Pretty easy and Not easy into a list
from the page source of https://docs.google.com/forms/d/1Mout_ImbF9N16EuCiYOxCrL6MbkUVkIEzijO1PAUQ68/viewform?key=pqbhTz7PIHum_4qKEdbUWVg
and then print out the element in the list
The following is the c# code which i have written based on the youtube video.
using System.Net;
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace ExtractDataFromWebsite
{
class Program
{
static void Main(string[] args)
{
List<string> radioOptions = new List<string>();
WebClient web = new WebClient();
// download html from certain website
string html = web.DownloadString("https://docs.google.com/forms/d/1Mout_ImbF9N16EuCiYOxCrL6MbkUVkIEzijO1PAUQ68/viewform?key=pqbhTz7PIHum_4qKEdbUWVg");
MatchCollection m1 = Regex.Matches(html, @"<input\stype=/"radio"\sname=/"entry.2362106 / "\svalue="(.+)\sid =/ "group_2362106_"
, RegexOptions.Singleline);
foreach (Match m in m1)
{
string radioOption = m.Groups[1].Value;
radioOptions.Add(radioOption);
}
for (int i=0; i< radioOptions.Count;i++)
Console.WriteLine(""+ radioOptions[i]);
Console.ReadKey();
}
}
}
However the line MatchCollection m1 = Regex.Matches...... has some problem which i do not know how to fix.
Hope someone can provide me some hint or help to solve the above problem Thank you very much