refactor: simplify link to bv

This commit is contained in:
YunYouJun
2022-06-05 18:30:49 +08:00
parent 8d7021bcfd
commit 34eb9b34e0
8 changed files with 1316 additions and 1169 deletions

View File

@@ -12,7 +12,7 @@ function run() {
const csvData = fs.readFileSync(recipeCsvFile, 'utf-8')
const lines = csvData.split(/\r?\n/)
const headers = 'name,stuff,link,difficulty,tags,methods,tools,'
const headers = 'name,stuff,bv,difficulty,tags,methods,tools,'
if (lines[0].trim() !== headers) {
consola.warn(`Headers Changed: ${lines[0]}`)
return
@@ -29,7 +29,9 @@ function run() {
name: attrs[0].trim(),
stuff,
emojis: generateEmojisFromStuff(stuff),
link: attrs[2].trim(),
// link: attrs[2].trim(),
// bv id
bv: attrs[2].trim().replace('https://www.bilibili.com/video/', ''),
difficulty: attrs[3] && attrs[3].trim() as RecipeItem['difficulty'],
tags: attrs[4] ? attrs[4].trim().split(sep) : [],
methods: attrs[5] ? (attrs[5].trim().split(sep)) as RecipeItem['methods'] : [],