cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
lala
Level VII

这个网站的数据怎样用脚本分析地址怎样获取并下载?

大家好!

这个网站是异步加载数据的

 

怎样用脚本分析地址怎样获取并下载?

 

谢谢!

2 REPLIES 2
lala
Level VII

回复: 这个网站的数据怎样用脚本分析地址怎样获取并下载?

https://www.jamesallen.com/loose-diamonds/all-diamonds/?sideView=true&Color=M,L,K,J,I,H,G,F,E,D&Cut=... 

 

 

This post'body

{"query":"{\n searchByIDs(price:{from:200, to:5000000} \n carat:{from:0.05, to:30} \n page:{count:5, size:23, number:16}depth:{from:46, to:78}tableSize:{from:52, to:80}color:{from: 1 to: 13} cut:{from: 0 to: 4} clarity:{from: 1 to: 9} shippingDays:999 ) { \n total\n hits\n pageNumber\n numberOfPages\n items {\n \n categories\n productID\n sku\n productType\n generalType\n isExpressShipping\n galleryUrl\n title\n description\n itemID\n sku\n shippingDate\n shippingDates{\n shippingDate {\n date\n byValentines\n byNewYears\n byXmas\n isFastShipping\n } invShippingDate {\n date\n byValentines\n byNewYears\n byXmas\n isFastShipping\n }}\n isFirmShipping\n price\n salePrice\n originalPrice\n url\n metaTitle\n metaDescription\n targetSite\n status {\n id\n name\n }\n media {\n thumb\n hearts\n arrows\n gallery\n gallerySet\n galleryDisplayType\n stageDisplayType\n segomaPhotoID\n tab\n stage\n stageSet\n supperZoom\n supperZoomSet\n sideView\n cert\n cart\n }\n stone {\n simpleColor\n species\n variety\n treatment\n ratio\n isTrueHearts\n isGemstonePair\n fancyColorOvertone\n measurements\n measureLength\n measureWidth\n isLabDiamond\n isArgyle\n carat\n shape {\n id\n name\n }\n color {\n id\n name\n isFancy\n }\n cut {\n id\n name\n }\n clarity {\n id\n name\n }\n lab {\n id\n name\n }\n flour {\n id\n name\n fullName\n }\n symmetry {\n id\n name\n fullName\n }\n polish {\n id\n name\n fullName\n }\n colorIntensity {\n id\n name\n }\n depth\n tableSize\n }\n \n }\n }\n }"}
lala
Level VII

回复: 这个网站的数据怎样用脚本分析地址怎样获取并下载?

It can download with VBA

Sub test()
    Dim userAgent, params, url, json, res, x, y, arr(20001, 1 To 10)
pp={"query": "{searchByIDs(price:{from:1000, to:5000000} shapeID:[7]  carat:{from:0.05, to:30}  page:{count:100, size:1, number:1} depth:{from:46, to:78} tableSize:{from:52, to:80} color:{from: 1 to: 13} cut:{from: 0 to: 4} clarity:{from: 1 to: 9}  isLabDiamond:false shippingDays:999 ) {total   hits   pageNumber   numberOfPages  items { categories  productID  sku  productType  generalType  isExpressShipping  galleryUrl  title  description  itemID  sku  shippingDate  shippingDates{  shippingDate {    date    byValentines    byNewYears    byXmas    isFastShipping  } invShippingDate {    date    byValentines    byNewYears    byXmas    isFastShipping  }}  isFirmShipping  price  salePrice  originalPrice  url  metaTitle  metaDescription  targetSite  status {    id    name  }   stone {    simpleColor    species    variety    treatment    ratio    isTrueHearts    isGemstonePair    fancyColorOvertone    measurements    measureLength    measureWidth    isLabDiamond    isArgyle    carat    shape { id name }    color { id name isFancy}    cut { id name}    clarity { id name}    lab { id name}    flour { id name fullName }    symmetry { id name fullName } polish { id name fullName }  colorIntensity { id name } depth tableSize}}}}"}

    url = "https://product-service.r2net.com/diamond/v/2/"
    With CreateObject("WinHttp.WinHttpRequest.5.1")
        .Open "Post", url, False
        .SetRequestHeader "content-type", "application/json"
        .Send pp
        Set json = JsonConverter.ParseJson(.Responsetext)
        Set res = json("data")("searchByIDs")("items")
            arr(y, 1) = "sku"
            arr(y, 2) = "price"
            arr(y, 3) = "salePrice"
            arr(y, 4) = "originalPrice"
            arr(y, 5) = "title"
        For Each x In res
            y = y + 1
            arr(y, 1) = x(1)("sku")
            arr(y, 2) = x(1)("price")
            arr(y, 3) = x(1)("salePrice")
            arr(y, 4) = x(1)("originalPrice")
            arr(y, 5) = x(1)("title")
        Next
    End With
    Sheet2.Range("A1").Resize(20001, 10) = arr
End Sub

2022-02-16_145305.png