bet365.comからデータを取得したいのですが、問題は、ページソースをダウンロードすると、そのデータがページソースに含まれていないことです。私が検索したように、シングルページアプリケーションでは、すべてがすぐに読み込まれません。私は次のコードを試しましたが、希望のデータを得ることができませんでした。誰も助けることができますか?シングルページのウェブサイトを掻き集める
public string GetGeneratedHTML(string url)
{
URL = url;
Thread t = new Thread(new ThreadStart(WebBrowserThread));
t.SetApartmentState(ApartmentState.STA);
t.Start();
t.Join();
return GeneratedSource;
}
private void WebBrowserThread()
{
WebBrowser wb = new WebBrowser();
wb.Navigate(URL);
wb.DocumentCompleted +=
new WebBrowserDocumentCompletedEventHandler(
wb_DocumentCompleted);
while (wb.ReadyState != WebBrowserReadyState.Complete)
Application.DoEvents();
//Added this line, because the final HTML takes a while to show up
GeneratedSource = wb.Document.Body.InnerHtml;
wb.Dispose();
}`enter code here`
private void wb_DocumentCompleted(object sender,
WebBrowserDocumentCompletedEventArgs e)
{
WebBrowser wb = (WebBrowser)sender;
GeneratedSource = wb.Document.Body.InnerHtml;
}
はそうベット365は、コードの一部は、私がサイト上で何を参照してください。また、ページのソースで見つけることができませんでした –
スクレーパーが好きではありません。 –