Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-2-capstone-design1
/
HCG_project
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
GyuhoLee
2020-11-02 17:37:59 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
df29a03abe030b6ed5d86ea503b51e23240d524d
df29a03a
1 parent
490adab6
[Update] 변환된 xml을 문장별로 string list로 파싱
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
15 deletions
src/.idea/workspace.xml
src/subtitle.py
src/.idea/workspace.xml
View file @
df29a03
...
...
@@ -20,14 +20,8 @@
</component>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"b9decb0c-dc9e-4239-bdad-09ea8dd5179d"
name=
"Default Changelist"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/.idea/.gitignore"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/inspectionProfiles/profiles_settings.xml"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/misc.xml"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/modules.xml"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/src.iml"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/vcs.xml"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/subtitle.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/subtitle.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../캡스톤디자인_3주차_주간보고서.hwp"
beforeDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
...
...
@@ -101,22 +95,22 @@
</option>
</component>
<component
name=
"WindowStateProjectService"
>
<state
width=
"1899"
height=
"282"
key=
"GridCell.Tab.0.bottom"
timestamp=
"160430
4028779
"
>
<state
width=
"1899"
height=
"282"
key=
"GridCell.Tab.0.bottom"
timestamp=
"160430
6110978
"
>
<screen
x=
"1920"
y=
"0"
width=
"1920"
height=
"1040"
/>
</state>
<state
width=
"1899"
height=
"282"
key=
"GridCell.Tab.0.bottom/0.0.1920.1040/1920.0.1920.1040@1920.0.1920.1040"
timestamp=
"160430
4028779
"
/>
<state
width=
"1899"
height=
"282"
key=
"GridCell.Tab.0.center"
timestamp=
"160430
4028779
"
>
<state
width=
"1899"
height=
"282"
key=
"GridCell.Tab.0.bottom/0.0.1920.1040/1920.0.1920.1040@1920.0.1920.1040"
timestamp=
"160430
6110978
"
/>
<state
width=
"1899"
height=
"282"
key=
"GridCell.Tab.0.center"
timestamp=
"160430
6110978
"
>
<screen
x=
"1920"
y=
"0"
width=
"1920"
height=
"1040"
/>
</state>
<state
width=
"1899"
height=
"282"
key=
"GridCell.Tab.0.center/0.0.1920.1040/1920.0.1920.1040@1920.0.1920.1040"
timestamp=
"160430
4028779
"
/>
<state
width=
"1899"
height=
"282"
key=
"GridCell.Tab.0.left"
timestamp=
"160430
4028779
"
>
<state
width=
"1899"
height=
"282"
key=
"GridCell.Tab.0.center/0.0.1920.1040/1920.0.1920.1040@1920.0.1920.1040"
timestamp=
"160430
6110978
"
/>
<state
width=
"1899"
height=
"282"
key=
"GridCell.Tab.0.left"
timestamp=
"160430
6110978
"
>
<screen
x=
"1920"
y=
"0"
width=
"1920"
height=
"1040"
/>
</state>
<state
width=
"1899"
height=
"282"
key=
"GridCell.Tab.0.left/0.0.1920.1040/1920.0.1920.1040@1920.0.1920.1040"
timestamp=
"160430
4028779
"
/>
<state
width=
"1899"
height=
"282"
key=
"GridCell.Tab.0.right"
timestamp=
"160430
4028779
"
>
<state
width=
"1899"
height=
"282"
key=
"GridCell.Tab.0.left/0.0.1920.1040/1920.0.1920.1040@1920.0.1920.1040"
timestamp=
"160430
6110978
"
/>
<state
width=
"1899"
height=
"282"
key=
"GridCell.Tab.0.right"
timestamp=
"160430
6110978
"
>
<screen
x=
"1920"
y=
"0"
width=
"1920"
height=
"1040"
/>
</state>
<state
width=
"1899"
height=
"282"
key=
"GridCell.Tab.0.right/0.0.1920.1040/1920.0.1920.1040@1920.0.1920.1040"
timestamp=
"160430
4028779
"
/>
<state
width=
"1899"
height=
"282"
key=
"GridCell.Tab.0.right/0.0.1920.1040/1920.0.1920.1040@1920.0.1920.1040"
timestamp=
"160430
6110978
"
/>
<state
x=
"2381"
y=
"164"
key=
"SettingsEditor"
timestamp=
"1604303734485"
>
<screen
x=
"1920"
y=
"0"
width=
"1920"
height=
"1040"
/>
</state>
...
...
src/subtitle.py
View file @
df29a03
from
pytube
import
YouTube
from
xml.etree
import
ElementTree
#youtube url의 자막 -> xml으로 가져오기
video_url
=
'https://www.youtube.com/watch?v=ecUWKU_v318'
yt
=
YouTube
(
video_url
)
title
=
yt
.
title
description
=
yt
.
description
caption
=
yt
.
captions
.
get_by_language_code
(
'ko'
)
caption_xml
=
caption
.
xml_captions
#xml -> string list로 파싱(문장별)
root
=
ElementTree
.
fromstring
(
caption_xml
)
sentences
=
[]
print
(
root
.
tag
,
root
.
attrib
)
for
child
in
root
.
findall
(
"text"
):
sentences
.
append
(
child
.
text
.
replace
(
'
\n
'
,
' '
))
print
(
sentences
)
\ No newline at end of file
...
...
Please
register
or
login
to post a comment