#

Wie kann man eine Webseite aus dem Internet herunterladen und als Datei speichern


Ich habe hier mein altes script gefunden, mit dem ich tausende von Seiten automatisch heruntergeladen habe und als Textdatei dann lokal ausgewertet habe
Man kann mit vb.net sehr einfach komplette Webseiten als File lokal speichern.
Hierzu verwendet man den Webclient und führt dann die Methode Downloadfile (URL in lokale Datei) aus

'< download >
Dim objDownloader As New WebClient
objDownloader.DownloadFile(sURLDownload, sDateiLocal)
'</ download >




Hier das script

Public Function fxDownload() As Boolean

Dim bOK As Boolean = False

'< kontrolle >

If Not ctlError.Text = "" Then

addLog("kein download da error")

Exit Function

End If

'</ kontrolle >

'< init >

Dim sURLDownload As String = ctlURLDownload.Text

Dim sDateiLocal As String = ctlDateiImport.Text

'</ init >

'< Kontrolle >

If sURLDownload Like "" Then addError("es wurde keine URL_download definiert") : Exit Function

If sDateiLocal Like "" Then addError("es wurde keine IDClient definiert") : Exit Function

'</ Kontrolle >

'< exe:download >

addstatus("< download >")

lblStatusKennung.BackColor = Color.Orange

Try

'< download >

Dim objDownloader As New WebClient

objDownloader.DownloadFile(sURLDownload, sDateiLocal)

'</ download >

'URLDownloadToFile(0, sURLDownload, sDateiLocal, 0, 0) 'stabiler vorgang aber aussetzter bei vb.net

'< Erfolgspruefung >

If File.Exists(sDateiLocal) Then

bOK = True

Else

addError("Die Importdatei fehlt")

bOK = False

End If

'</ Erfolgspruefung >

Catch ex As Exception

addError(ex.Message & vbCrLf & ex.StackTrace)

bOK = False

End Try

addstatus("</ download >")

'</ exe:download >

'Abschluss

Return bOK
End Function

Mobile

.

yesmovies