9 Commits
1.7.3 ... 1.7.5

Author SHA1 Message Date
IndieKKY
0b4890399a chore: release 1.7.5 2023-11-18 08:51:35 +08:00
IndieKKY
51bf522eeb 添加youtube版字幕列表链接 2023-11-18 08:51:21 +08:00
IndieKKY
a5808d8385 chore: release 1.7.4 2023-11-18 08:47:52 +08:00
IndieKKY
e005c5e214 添加youtube版字幕列表链接 2023-11-18 08:47:35 +08:00
IndieKKY
e7e8758716 optimize 2023-09-15 21:59:33 +08:00
IndieKKY
49e311a9ed update push 2023-07-26 09:30:41 +08:00
IndieKKY
a1462ae2f2 gitignore 2023-07-23 14:20:18 +08:00
IndieKKY
2b0d294c2a default_locale 2023-07-22 19:31:37 +08:00
IndieKKY
2825f9355a git ignore 2023-07-12 21:03:15 +08:00
9 changed files with 46 additions and 14 deletions

2
.gitignore vendored
View File

@@ -25,3 +25,5 @@ dist-ssr
*.sw?
stats.html
dist.zip
360/

BIN
dist.zip

Binary file not shown.

View File

@@ -1,7 +1,7 @@
{
"name": "哔哩哔哩字幕列表",
"description": "显示B站视频的字幕列表,可点击跳转与下载字幕,并支持翻译和总结字幕!",
"version": "1.7.3",
"version": "1.7.5",
"manifest_version": 3,
"permissions": [
"storage"

View File

@@ -1,7 +1,7 @@
{
"private": true,
"name": "bilibili-subtitle",
"version": "1.7.3",
"version": "1.7.5",
"type": "module",
"description": "哔哩哔哩字幕列表",
"main": "index.js",

BIN
public/youtube-subtitle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -25,6 +25,7 @@ echo "Version updated to: $new_version"
# build
pnpm run build_chrome
# zip dist
rm -f dist.zip
cd dist
zip -r ../dist.zip ./*
cd ../

View File

@@ -18,6 +18,7 @@ import {HEADER_HEIGHT, PAGE_SETTINGS, SUMMARIZE_ALL_THRESHOLD, SUMMARIZE_TYPES,
import {FaClipboardList} from 'react-icons/fa'
import useTranslate from '../hooks/useTranslate'
import {getSummarize} from '../util/biz_util'
import {openUrl} from '@kky002/kky-util'
const Body = () => {
const dispatch = useAppDispatch()
@@ -176,6 +177,20 @@ const Body = () => {
<div className='text-sm desc px-2'><span className='text-amber-600 font-semibold'></span><span className='text-secondary/75 font-semibold'></span>🥳</div>
{(segments?.length??0) > 0 && <button className='mt-1.5 btn btn-xs btn-info' onClick={onCopy}>{SUMMARIZE_TYPES[curSummaryType].name}<RiFileCopy2Line/></button>}
</div>
<div className='flex flex-col items-center text-center py-2 mx-4 border-t border-t-base-300'>
<div className='font-semibold text-accent flex items-center gap-1'><img src='/youtube-subtitle.png' alt='youtube subtitle' className='w-8 h-8'/>Youtube Subtitle</div>
<div className='text-sm px-2 desc'><span className='text-amber-600 font-semibold text-base'>Youtube</span></div>
<div className='flex gap-2'>
<a title='Chrome商店' href='https://chromewebstore.google.com/detail/fiaeclpicddpifeflpmlgmbjgaedladf' onClick={(e) => {
e.preventDefault()
openUrl('https://chromewebstore.google.com/detail/fiaeclpicddpifeflpmlgmbjgaedladf')
}} className='link text-sm text-accent'>Chrome商店</a>
<a title='Edge商店' href='https://microsoftedge.microsoft.com/addons/detail/galeejdehabppfgooagmkclpppnbccpc' onClick={e => {
e.preventDefault()
openUrl('https://microsoftedge.microsoft.com/addons/detail/galeejdehabppfgooagmkclpppnbccpc')
}} className='link text-sm text-accent'>Edge商店</a>
</div>
</div>
</div>
</div>
}

View File

@@ -259,6 +259,16 @@ const MoreBtn = (props: Props) => {
(IndieKKY)
</a>
</li>
<li className='hover:bg-accent'>
<a className='flex items-center' onClick={(e) => {
e.preventDefault()
e.stopPropagation()
openUrl('https://chromewebstore.google.com/detail/fiaeclpicddpifeflpmlgmbjgaedladf')
}}>
<img alt='youtube subtitle' src='/youtube-subtitle.png' className='w-[20px] h-[20px] bg-white rounded-sm p-0.5'/>
Youtube Subtitle
</a>
</li>
<li className='hover:bg-accent'>
<a className='flex items-center' onClick={(e) => {
dispatch(setPage(PAGE_SETTINGS))

View File

@@ -203,12 +203,13 @@ export const parseTranscript = (filename: string, text: string | ArrayBuffer): T
if (filename.toLowerCase().endsWith('.srt')) {
const lines = text.split('\n\n')
for (const line of lines) {
const lines = line.split('\n')
if (lines.length >= 3) {
const time = lines[1].split(' --> ')
try {
const linesInner = line.trim().split('\n')
if (linesInner.length >= 3) {
const time = linesInner[1].split(' --> ')
const from = parseTime(time[0])
const to = parseTime(time[1])
const content = lines.slice(2).join('\n')
const content = linesInner.slice(2).join('\n')
items.push({
from,
to,
@@ -216,6 +217,9 @@ export const parseTranscript = (filename: string, text: string | ArrayBuffer): T
idx: items.length,
})
}
} catch (e) {
console.error('parse error', line)
}
}
}
// .vtt: