完成数据清洗
This commit is contained in:
parent
da848c9128
commit
a070f82853
@ -15,7 +15,7 @@ dependencies {
|
||||
implementation('org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1')
|
||||
implementation 'org.jsoup:jsoup:1.18.3'
|
||||
implementation "org.ktorm:ktorm-core:4.1.1"
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3'
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1'
|
||||
implementation("mysql:mysql-connector-java:8.0.33")
|
||||
}
|
||||
|
||||
|
@ -24,21 +24,22 @@ suspend fun main(args: Array<String>) {
|
||||
|
||||
val database = Database.connect(
|
||||
url = "jdbc:mysql://localhost:3306/sif_card",
|
||||
driver = "com.mysql.jdbc.Driver",
|
||||
driver = "com.mysql.cj.jdbc.Driver",
|
||||
user = "root",
|
||||
password = ""
|
||||
)
|
||||
|
||||
cardList.forEach { card ->
|
||||
database.useTransaction {
|
||||
val count = database
|
||||
.from(TCard)
|
||||
.select()
|
||||
.where { TCard.name eq card.name }
|
||||
.totalRecordsInAllPages
|
||||
if (count > 0) {
|
||||
var id = -1
|
||||
for (row in database.from(TCard).select().where { TCard.name eq card.name }) {
|
||||
row[TCard.characterName]?.let { characterName ->
|
||||
if (characterName.isNotEmpty()) {
|
||||
return@forEach
|
||||
}
|
||||
id = row[TCard.id]!!
|
||||
}
|
||||
}
|
||||
|
||||
gameList.find { gameCh -> gameCh.name.contains(card.name) }?.let { gameCh ->
|
||||
println(gameCh.url)
|
||||
@ -89,9 +90,11 @@ suspend fun main(args: Array<String>) {
|
||||
tables[4].select(".mu__table--row2").apply {
|
||||
card.specialSkillInfo = select(".mu__table--col1").text()
|
||||
}
|
||||
}
|
||||
} ?: run { return@forEach }
|
||||
|
||||
println(card)
|
||||
|
||||
if (id == -1) {
|
||||
database.insert(TCard) {
|
||||
set(it.name, card.name)
|
||||
set(it.characterId, card.characterId)
|
||||
@ -113,6 +116,28 @@ suspend fun main(args: Array<String>) {
|
||||
set(it.specialSkillName, card.specialSkillName)
|
||||
set(it.specialSkillInfo, card.specialSkillInfo)
|
||||
}
|
||||
} else {
|
||||
database.update(TCard) {
|
||||
set(it.characterName, card.characterName)
|
||||
set(it.type, card.type)
|
||||
set(it.rarity, card.rarity)
|
||||
set(it.maxLevel, card.maxLevel)
|
||||
set(it.maxHp, card.maxHp)
|
||||
set(it.smile, card.smile)
|
||||
set(it.pure, card.pure)
|
||||
set(it.cool, card.cool)
|
||||
set(it.illustId, card.illustId)
|
||||
set(it.evolveIllustId, card.evolveIllustId)
|
||||
set(it.group, card.group)
|
||||
set(it.team, card.team)
|
||||
set(it.date, card.date)
|
||||
set(it.centerSkillName, card.centerSkillName)
|
||||
set(it.centerSkillInfo, card.centerSkillInfo)
|
||||
set(it.specialSkillName, card.specialSkillName)
|
||||
set(it.specialSkillInfo, card.specialSkillInfo)
|
||||
where { TCard.id eq id }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delay(1000)
|
||||
|
@ -457,7 +457,7 @@
|
||||
{
|
||||
"id": 10050010,
|
||||
"characterId": 1005,
|
||||
"name": "μ'sの元気印",
|
||||
"name": "μ'sの元気印",
|
||||
"illustId": "01005_0010_00",
|
||||
"evolveIllustId": "01005_0010_01"
|
||||
},
|
||||
|
@ -1,7 +1,7 @@
|
||||
[
|
||||
{
|
||||
"url": "https://gamerch.com/lovelivesif2/767609",
|
||||
"name": "[Aquoursと申しますわ!]黒澤ダイヤ",
|
||||
"name": "[Aqoursと申しますわ!]黒澤ダイヤ",
|
||||
"rarity": 2
|
||||
},
|
||||
{
|
||||
@ -31,17 +31,17 @@
|
||||
},
|
||||
{
|
||||
"url": "https://gamerch.com/lovelivesif2/758859",
|
||||
"name": "[μ’sと私]矢澤にこ",
|
||||
"name": "[µ'sと私]矢澤にこ",
|
||||
"rarity": 1
|
||||
},
|
||||
{
|
||||
"url": "https://gamerch.com/lovelivesif2/811888",
|
||||
"name": "[μ’sのクリスマス]園田海未",
|
||||
"name": "[µ'sのクリスマス]園田海未",
|
||||
"rarity": 1
|
||||
},
|
||||
{
|
||||
"url": "https://gamerch.com/lovelivesif2/748012",
|
||||
"name": "[μ’sへの想い]小泉花陽",
|
||||
"name": "[µ'sへの想い]小泉花陽",
|
||||
"rarity": 1
|
||||
},
|
||||
{
|
||||
@ -121,7 +121,7 @@
|
||||
},
|
||||
{
|
||||
"url": "https://gamerch.com/lovelivesif2/748007",
|
||||
"name": "[いらっしゃませ♪]南ことり",
|
||||
"name": "[いらっしゃいませ♪]南ことり",
|
||||
"rarity": 1
|
||||
},
|
||||
{
|
||||
@ -781,7 +781,7 @@
|
||||
},
|
||||
{
|
||||
"url": "https://gamerch.com/lovelivesif2/767340",
|
||||
"name": "[サプライズBBQ]宮下愛",
|
||||
"name": "[サプライズBBQ]宮下愛",
|
||||
"rarity": 1
|
||||
},
|
||||
{
|
||||
@ -1536,7 +1536,7 @@
|
||||
},
|
||||
{
|
||||
"url": "https://gamerch.com/lovelivesif2/815232",
|
||||
"name": "[噓も方便]鬼塚夏美",
|
||||
"name": "[嘘も方便]鬼塚夏美",
|
||||
"rarity": 1
|
||||
},
|
||||
{
|
||||
@ -1551,7 +1551,7 @@
|
||||
},
|
||||
{
|
||||
"url": "https://gamerch.com/lovelivesif2/748053",
|
||||
"name": "[地上230メートル]桜小路きな子",
|
||||
"name": "[地上230メートル]桜小路きな子",
|
||||
"rarity": 1
|
||||
},
|
||||
{
|
||||
@ -1691,7 +1691,7 @@
|
||||
},
|
||||
{
|
||||
"url": "https://gamerch.com/lovelivesif2/767462",
|
||||
"name": "[好きなった内浦]桜内梨子",
|
||||
"name": "[好きになった内浦]桜内梨子",
|
||||
"rarity": 3
|
||||
},
|
||||
{
|
||||
@ -1801,7 +1801,7 @@
|
||||
},
|
||||
{
|
||||
"url": "https://gamerch.com/lovelivesif2/767420",
|
||||
"name": "[思いを馳せて]高海千歌",
|
||||
"name": "[想いを馳せて]高海千歌",
|
||||
"rarity": 3
|
||||
},
|
||||
{
|
||||
@ -2081,7 +2081,7 @@
|
||||
},
|
||||
{
|
||||
"url": "https://gamerch.com/lovelivesif2/767417",
|
||||
"name": "[水泳日和]高海千歌",
|
||||
"name": "[水泳日和!]高海千歌",
|
||||
"rarity": 3
|
||||
},
|
||||
{
|
||||
@ -2116,7 +2116,7 @@
|
||||
},
|
||||
{
|
||||
"url": "https://gamerch.com/lovelivesif2/818426",
|
||||
"name": "[海を眺める初日の出]高海千歌",
|
||||
"name": "[海で眺める初日の出]高海千歌",
|
||||
"rarity": 1
|
||||
},
|
||||
{
|
||||
@ -2391,7 +2391,7 @@
|
||||
},
|
||||
{
|
||||
"url": "https://gamerch.com/lovelivesif2/815221",
|
||||
"name": "[笑う門には福来る]嵐千砂都",
|
||||
"name": "[笑う門には福来たる]嵐千砂都",
|
||||
"rarity": 1
|
||||
},
|
||||
{
|
||||
@ -2416,7 +2416,7 @@
|
||||
},
|
||||
{
|
||||
"url": "https://gamerch.com/lovelivesif2/766205",
|
||||
"name": "[紅絣のかざぐるま]優木せつ菜",
|
||||
"name": "[紅緋のかざぐるま]優木せつ菜",
|
||||
"rarity": 2
|
||||
},
|
||||
{
|
||||
@ -2601,7 +2601,7 @@
|
||||
},
|
||||
{
|
||||
"url": "https://gamerch.com/lovelivesif2/823803",
|
||||
"name": "[試食挑戦者募集]若菜四季",
|
||||
"name": "[試食挑戦者募集中]若菜四季",
|
||||
"rarity": 2
|
||||
},
|
||||
{
|
||||
@ -2636,7 +2636,7 @@
|
||||
},
|
||||
{
|
||||
"url": "https://gamerch.com/lovelivesif2/813588",
|
||||
"name": "[賑やかな街!]高海千歌",
|
||||
"name": "[にぎやかな街!]高海千歌",
|
||||
"rarity": 2
|
||||
},
|
||||
{
|
||||
@ -2746,7 +2746,7 @@
|
||||
},
|
||||
{
|
||||
"url": "https://gamerch.com/lovelivesif2/759114",
|
||||
"name": "[間違えないで~!]南ことり",
|
||||
"name": "[間違えないで〜!]南ことり",
|
||||
"rarity": 1
|
||||
},
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user