nice clean recipes pear.dunkirk.sh
recipes
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: check lazy src

+17 -4
+17 -4
internal/extract/schema/microdata.go
··· 99 99 if node.Type == html.ElementNode { 100 100 for _, attr := range node.Attr { 101 101 if attr.Key == "itemprop" && attr.Val == prop { 102 - // For img elements, use src/content 103 102 if node.Data == "img" { 104 - result = getAttrVal(node, "src") 103 + result = getImgSrc(node) 105 104 if result == "" { 106 105 result = getAttrVal(node, "content") 107 106 } ··· 136 135 for _, attr := range node.Attr { 137 136 if attr.Key == "itemprop" && (attr.Val == "image") { 138 137 if node.Data == "img" { 139 - if src := getAttrVal(node, "src"); src != "" { 138 + if src := getImgSrc(node); src != "" { 140 139 return src 141 140 } 142 141 } ··· 168 167 if attr.Key == "itemprop" && attr.Val == prop { 169 168 text := "" 170 169 if node.Data == "img" { 171 - text = getAttrVal(node, "src") 170 + text = getImgSrc(node) 172 171 } else if node.Data == "meta" { 173 172 text = getAttrVal(node, "content") 174 173 } else { ··· 188 187 } 189 188 f(n) 190 189 return results 190 + } 191 + 192 + func getImgSrc(n *html.Node) string { 193 + if src := getAttrVal(n, "data-lazy-src"); src != "" && !strings.HasPrefix(src, "data:") { 194 + return src 195 + } 196 + if src := getAttrVal(n, "data-src"); src != "" && !strings.HasPrefix(src, "data:") { 197 + return src 198 + } 199 + src := getAttrVal(n, "src") 200 + if src != "" && !strings.HasPrefix(src, "data:") { 201 + return src 202 + } 203 + return "" 191 204 } 192 205 193 206 func getAttrVal(n *html.Node, key string) string {