Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨[Feature/adult thumbnail-228] 성인용 웹툰 썸네일 적용 #229

Open
wants to merge 3 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/main/java/kr/co/antoon/aws/application/AwsS3Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.amazonaws.services.s3.model.CannedAccessControlList;
import com.amazonaws.services.s3.model.ObjectMetadata;
import com.amazonaws.services.s3.model.PutObjectRequest;
import kr.co.antoon.aws.domain.vo.AdultThumbnailType;
import kr.co.antoon.aws.domain.vo.AntDefaultImageName;
import kr.co.antoon.aws.domain.vo.S3Category;
import kr.co.antoon.error.exception.aws.FileUploadInvalidException;
Expand Down Expand Up @@ -55,6 +56,11 @@ public String randomProfileImage() {
return amazonS3Client.getUrl(bucketName, fileName).toString();
}

public String adultThumbnailImage(AdultThumbnailType type) {
var fileName = S3Category.ADULT_THUMBNAIL + "/" + type + ".png";
return amazonS3Client.getUrl(bucketName, fileName).toString();
}

public static String buildFileName(S3Category category, String originalFileName) {
var fileExtenstionIndex = originalFileName.lastIndexOf(FILE_EXTENSION_SEPARATOR);
var fileExtension = originalFileName.substring(fileExtenstionIndex);
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/kr/co/antoon/aws/domain/vo/AdultThumbnailType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package kr.co.antoon.aws.domain.vo;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum AdultThumbnailType {
KAKAO("카카오 웹툰"),
NAVER("네이버 웹툰"),
DETAIL("상세 조회"),
RANK("랭킹 조회"),
;

private final String description;
}
1 change: 1 addition & 0 deletions src/main/java/kr/co/antoon/aws/domain/vo/S3Category.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public enum S3Category {
VOTE("투표"),
TEST("업로드 테스트용"),
ANT_DEFAULT("기본 개미 이미지"),
ADULT_THUMBNAIL("성인용 웹툰 썸네일")
;

private final String description;
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/kr/co/antoon/crawling/NaverWebtoonCrawling.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ public WebtoonCrawlingDto crawling() {

// log.info("[Naver Webtoon Crawling] title-> {} / url -> {}", title, url);

// TODO: 18세 연령가, 12세 연령가, 전체 연령가 이렇게 저장되는데 숫자만 저장하도록 split
// TODO: 여기서 성인용 웹툰 썸네일을 19금 썸네일로 대체할지, 아님 기존 썸네일 저장하고, 조회할 때 19금 썸네일로 할지
var age = innerElement.select("span.age").text();
return new WebtoonCrawlingDto.WebtoonCrawlingDetail(
title,
content,
Expand Down