-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from kakao-tech-campus-2nd-step3/weekly/6
CICD 테스트
- Loading branch information
Showing
75 changed files
with
2,335 additions
and
1,028 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/java/team7/inplace/crawling/application/AddressUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package team7.inplace.crawling.application; | ||
|
||
import static lombok.AccessLevel.PRIVATE; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor(access = PRIVATE) | ||
public class AddressUtil { | ||
private static final String ADDRESS_REGEX = "[가-힣0-9]+(?:도|시|구|군|읍|면|동|리|로|길)[^#,\\n()]+(?:동|읍|면|리|로|길|호|층|번지)[^#,\\n()]+"; | ||
|
||
public static String extractAddress(JsonNode snippet) { | ||
|
||
String videoDescription = snippet.path("description").asText(); | ||
|
||
Pattern pattern = Pattern.compile(ADDRESS_REGEX); | ||
Matcher matcher = pattern.matcher(videoDescription); | ||
if (matcher.find()) { | ||
return matcher.group(); | ||
} | ||
return null; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/team7/inplace/crawling/application/CrawlingFacade.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package team7.inplace.crawling.application; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import team7.inplace.global.annotation.Facade; | ||
import team7.inplace.video.application.VideoFacade; | ||
|
||
@Facade | ||
@RequiredArgsConstructor | ||
public class CrawlingFacade { | ||
private final YoutubeCrawlingService youtubeCrawlingService; | ||
private final VideoFacade videoFacade; | ||
|
||
public void updateVideos() { | ||
var crawlingInfos = youtubeCrawlingService.crawlAllVideos(); | ||
for (var crawlingInfo : crawlingInfos) { | ||
var videoCommands = crawlingInfo.toVideoCommands(); | ||
var placesCommands = crawlingInfo.toPlacesCommands(); | ||
|
||
videoFacade.createVideos(videoCommands, placesCommands); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/java/team7/inplace/crawling/application/dto/CrawlingInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package team7.inplace.crawling.application.dto; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import java.util.List; | ||
import team7.inplace.crawling.client.dto.PlaceNode; | ||
import team7.inplace.place.application.command.PlacesCommand; | ||
import team7.inplace.video.application.command.VideoCommand; | ||
|
||
public record CrawlingInfo( | ||
Long influencerId, | ||
List<JsonNode> videoSnippets, | ||
List<PlaceNode> placeNodes | ||
) { | ||
public List<VideoCommand.Create> toVideoCommands() { | ||
return videoSnippets.stream() | ||
.map(snippet -> VideoCommand.Create.from(snippet, influencerId)) | ||
.toList(); | ||
} | ||
|
||
public List<PlacesCommand.Create> toPlacesCommands() { | ||
return placeNodes.stream() | ||
.map(placeNode -> PlacesCommand.Create.from(placeNode.locationNode(), placeNode.placeNode())) | ||
.toList(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/main/java/team7/inplace/crawling/client/dto/PlaceNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package team7.inplace.crawling.client.dto; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
|
||
public record PlaceNode( | ||
JsonNode locationNode, | ||
JsonNode placeNode | ||
) { | ||
public static PlaceNode of(JsonNode locationNode, JsonNode placeNode) { | ||
return new PlaceNode(locationNode, placeNode); | ||
} | ||
} |
Oops, something went wrong.