用 ScrapySharp 下载天涯图片
let urlToPicture (filePath: string) (url: string) =
// let url = "http://img3.laibafile.cn/getimgXXX/3/1/photo3/2011/7/25/middle/75564433_25049066_middle.jpg"
let path = filePath.Substring(0, filePath.LastIndexOf("."))
let ty ="http://bbs.tianya.cn"
let web = new ScrapySharp.Network.ScrapingBrowser()
web.NavigateToPage( new Uri(ty)) |> ignore
if not( IO.Directory.Exists( path ) ) then IO.Directory.CreateDirectory( path ) |> ignore
let file = url.Substring( url.LastIndexOf("/") )
let pic = (web.NavigateToPage( new Uri( url ))).RawResponse.Body
printfn "%s" url
File.WriteAllBytes( ( path + file ), pic )
let urlToPicture (filePath: string) (url: string) =
// let url = "http://img3.laibafile.cn/getimgXXX/3/1/photo3/2011/7/25/middle/75564433_25049066_middle.jpg"
let path = filePath.Substring(0, filePath.LastIndexOf("."))
let ty ="http://bbs.tianya.cn"
let web = new ScrapySharp.Network.ScrapingBrowser()
web.NavigateToPage( new Uri(ty)) |> ignore
if not( IO.Directory.Exists( path ) ) then IO.Directory.CreateDirectory( path ) |> ignore
let file = url.Substring( url.LastIndexOf("/") )
let pic = (web.NavigateToPage( new Uri( url ))).RawResponse.Body
printfn "%s" url
File.WriteAllBytes( ( path + file ), pic )