FooSoft / yomichan

Japanese pop-up dictionary extension for Chrome and Firefox.
https://foosoft.net/projects/yomichan
Other
1.07k stars 231 forks source link

Japanesepod101 Audio and Custom audio source (URL) #706

Closed grospoulpe closed 4 years ago

grospoulpe commented 4 years ago

I noticed, sometimes, a wrong pronunciation. For example: 心臓, instead of saying しんぞう, it says しんう It does with JapanesePod101, but with the alternate version, the pronunciation seems correct. And, I went to : https://www.japanesepod101.com/japanese-dictionary/ I found there a different (and correct) voice for this word. So, after founding that: https://github.com/FooSoft/yomichan/issues/471 and using that, for checking (seems that address is the one used for JapanesePod101) http://assets.languagepod101.com/dictionary/japanese/audiomp3.php?kanji={expression}&kana={reading}

Is it possible to add a custom audio source using the following JapanesePod101 dictionnary? https://www.japanesepod101.com/japanese-dictionary/

That could be really nice (and avoid listening to wrong pronunciation, sometimes)

Thanks, in advance!

toasted-nutbread commented 4 years ago

This actually is supported by using the "JapanesePod101 (Alternate)" option. However, this seems to be broken due to some changes to how the extension requests remote web pages. I will look into fixing this.

grospoulpe commented 4 years ago

Thanks for your answer 👍 Just to be sure I'm understood (English is not my native language) For 心臓 (and some others, but I can remember which ones) Audio playback Source: JapanesePod101 => wrong pronunciation (when put in the first position) JapanesePod101 (Alternate) => no pronunciation (see below) (first position) // I didn't noticed that it was, if fact, Jisho Jisho.org => good pronunciation Text-to-speech (Googe ja-JP) => OK

So, now I understand what you meant: "This actually is supported by using the "JapanesePod101 (Alternate)" option" So, thank, in advance, for fixing the Alternate version 👍

toasted-nutbread commented 4 years ago

Yes, everything you stated is correct. JapanesePod101 (not alternate) is wrong for 心臓 + しんぞう reading for some reason.

toasted-nutbread commented 4 years ago

Just FYI, the same issue will occur with the alternate source. 画像 is a good example, as its kanji is がぞう, but it gets pronounced as かぞう.

toasted-nutbread commented 4 years ago

FYI @FooSoft, we are nearing a good state for the next release. Several features, fixes, and structural improvements have been implemented. Over the next few days, I'm going to do some testing and finish up a few last things, so I'll probably have everything ready for a new release within the week.

FooSoft commented 4 years ago

@toasted-nutbread -- awesome :partying_face: ! Do we have an explanation for the webRequest and webRequestBlocking permissions? Chrome Web Store wants justifications.

toasted-nutbread commented 4 years ago

710

TL;DR fetch requests include the Origin header, and so does XMLHttpRequest on Chrome (but not Firefox), but the JPod101 alternate source will 404 the request if the origin is remote. This also improves security by not exposing the extension's chrome-extension://id, moz-extension://id, etc. to third-party domains.

This should hopefully not incur a warning about requiring additional privileges, but if it is, I can roll the change back and make the permissions optional instead. I have the testing version installed on a Chrome browser and will watch for the update to see what happens.

FooSoft commented 4 years ago

It should be fine, it's just that justifications have to be written for all permissions now.

toasted-nutbread commented 4 years ago

@FooSoft friendly reminder to bump testing to stable 😃

FooSoft commented 4 years ago

Yup, should be good to go to mainline :+1:

SpongebobSquamirez commented 4 years ago

I came here to complain about audio being wrong too. It happens all the time. For example, 的 (まと)returns audio for 窓 (まど). Insanely annoying.

toasted-nutbread commented 4 years ago

@weirdalsuperfan few questions:

SpongebobSquamirez commented 4 years ago
  • Which audio source are you having that issue for?
  • I have it on the JapanesePod101 alternative audio, but I switched to that after having the issue on the JapanesePod101 regular audio too, for other words that I can't remember
  • What option are you using for Result grouping?
  • Group results by term-reading pairs
  • What dictionaries do you have installed?
  • ヨガ日本語アクセント辞典 rev.Ver. 1
  • 新明解国語辞典 第五版 rev.Yoga 3
  • 三省堂 スーパー大辞林 rev.daijirin1
  • KireiCake rev.rikai2
  • NHK日本語発音アクセント新辞典 rev.1.0
  • What version of Yomichan are you on?
  • v20.8.24.1 (can't get it to update, although I also have the development build, which is on 20.9.28.0, just without anything installed...)
  • What browser?
  • Chrome Version 85.0.4183.121 (Official Build) (64-bit)
toasted-nutbread commented 4 years ago

Yeah, some of the audio clips from websites are just flat out wrong sometimes, as with your example here and some of the examples above. In this case, the information that JapanesePod101 (Alternate) gives is is the following:

<div class='dc-result-row__player-field'>
  <div class="di-player">
    <button type="button" class="js-play-dictionary" title="Play" aria-label="Play"></button>
    <audio preload="none" controls>
      <source src="https://www.japanesepod101.com/learningcenter/audio/vocabulary/2554.mp3" type="audio/mp3">
    </audio>
  </div>
  <div class="di-player play05">
    <button type="button" class="js-play-dictionary" title="Play" aria-label="Play"></button>
    <audio preload="none" controls>
      <source src="https://www.japanesepod101.com/learningcenter/audio/vocabulary/2554_b.mp3" type="audio/mp3">
    </audio>
  </div>
</div>
<div class="dc-result-row__vocab-field" lang=ja>
  <span class="dc-vocab-wrap">
    <span class='dc-vocab'>的</span> </span>
  <span class='dc-vocab_kana'>まと</span><span class='dc-vocab_romanization'>mato</span>
</div>

You'll notice that near the bottom, it very clearly indicates that the reading is まと (mato), but the audio pronounces it as まど (mado), as you mentioned. Unfortunately, there's nothing Yomichan can do about online dictionaries providing incorrect audio.

(can't get it to update, although I also have the development build, which is on 20.9.28.0, just without anything installed...)

The latest release is currently still in the testing-only release and should probably be bumped to stable within the week. Testing releases are usually out for a week or so before being promoted.