Skip to content

Commit

Permalink
refactor: Remove argument language
Browse files Browse the repository at this point in the history
  • Loading branch information
physicalattraction committed Sep 16, 2017
1 parent 95a2d94 commit 1c987a7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ if (!!button) {
}

function play(video_identifier) {
fetch_transcript('en', video_identifier)
fetch_transcript(video_identifier)
}
12 changes: 9 additions & 3 deletions xml_extractor.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
function fetch_transcript(language, video_identifier) {
function fetch_transcript(video_identifier) {
var xml = null
var languages = ['zh', 'ja', 'ko', 'es', 'fr', 'de', 'nl', 'en']
var languages = ['en', 'zh', 'ja', 'ko', 'es', 'fr', 'de', 'nl']
for (var i = 0; i < languages.length; i++) {
language = languages[i]
var language = languages[i]
xml = xml_extractor_http_get(language, video_identifier)
if (xml !== null) {
break
Expand All @@ -15,6 +15,12 @@ function fetch_transcript(language, video_identifier) {
var start_time = childNode.getAttribute('start')
var duration = childNode.getAttribute('dur')
var text = childNode.textContent
console.log(text)
// text = decodeURIComponent(text)
// for (var i = 0; i < 5; i++) {
// text = text.replace('&#39;', '\'')
// }
console.log(text)
var translated_text = translate(text, language, userLanguageInTwoCharacters())
play_line(start_time, duration, translated_text)
}
Expand Down

0 comments on commit 1c987a7

Please sign in to comment.