Skip to content

Commit

Permalink
fix: og 크롤링 정상 작동 시 http https 프로토콜 정보 제거 (#454)
Browse files Browse the repository at this point in the history
  • Loading branch information
fromitive authored Aug 22, 2024
1 parent 32ee912 commit b3ba1a2
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ public class OgTagProductImageExtractor implements ProductImageExtractor {
@Override
public String extract(String productUrl) {
String html = htmlCrawler.scrap(productUrl);
return htmlCrawler.parseOpenGraph(html, OG_IMAGE_PROPERTY);
return removeHttpHttps(htmlCrawler.parseOpenGraph(html, OG_IMAGE_PROPERTY));
}

public String removeHttpHttps(String url) {
if (url.startsWith("http:")) {
return url.substring("http:".length());
}
if (url.startsWith("https:")) {
return url.substring("https:".length());
}
return url;
}

}

0 comments on commit b3ba1a2

Please sign in to comment.