Comments (4)
I think I found the source for the information. Contained within a lesson explanation, there is a HTML table which basically contains the voice names within the html anchor links. Could probably use bs4 to scrape it out easily if you didn't want to do it manually. self.user_data['language_data'][lang]['skills'][n]['explanation']
. These links, however, are not in every explanation, so it might be necessary to iterate through the skill explanations to isolate the name.
"explanation": "<p>There are four main tones and one neutral tone in Mandarin Chinese to distinguish words and grammatical uses. </p>\n<table>\n<thead>\n<tr>\n<th>Tone</th>\n<th>Tone mark</th>\n<th>Pronunciation</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>The 1st tone</td>\n<td>“ˉ” like in mā</td>\n<td>High and flat (<a href=\"https://d1vq87e9lcf771.cloudfront.net/jiaoling/9420c9f11f68a53c9f3aab785935be99\">listen</a>)</td>\n</tr>\n<tr>\n<td>The 2nd tone</td>\n<td>“ˊ” like in má</td>\n<td>Rising (<a href=\"https://d1vq87e9lcf771.cloudfront.net/jiaoling/44d0791f329ed28a30a9d17fa4b4f158\">listen</a>)</td>\n</tr>\n<tr>\n<td>The 3rd tone</td>\n<td>“ˇ” like in mǎ</td>\n<td>Low then rising (<a href=\"https://d1vq87e9lcf771.cloudfront.net/jiaoling/11f22731028012457e2458e65ca5a2a5\">listen</a>)</td>\n</tr>\n<tr>\n<td>The 4th tone</td>\n<td>“ˋ” like in mà</td>\n<td>Falling (<a href=\"https://d1vq87e9lcf771.cloudfront.net/jiaoling/abcf3dcc7397a7cb12ff77d6614f05d3\">listen</a>)</td>\n</tr>\n<tr>\n<td>The neutral tone</td>\n<td>No mark like in ma</td>\n<td>Light (<a href=\"https://d1vq87e9lcf771.cloudfront.net/jiaoling/d34296b796bfcede214f232fcb77f84a\">listen</a>)</td>\n</tr>\n</tbody>\n</table>\n<p>Sometimes Chinese tones change based on the tone that follows it. There are three main places where you will see this: with all 3rd tones (low then rising tones), with the character 一 yī (1/one), and with the character 不 bù (no, not). Here we’ll take a quick look at how the 3rd tone changes. </p>\n<p>There are two main rules for how to pronounce the 3rd tone:\nWhen you have two 3rd tones together, the first one becomes a 2nd tone (rising tone).\nWhen you have a 3rd tone followed by any other non-3rd tone syllable, it only lowers, it doesn’t rise at the end.</p>\n<table>\n<thead>\n<tr>\n<th>Chinese</th>\n<th>Pinyin</th>\n<th>Actual Pronunciation</th>\n<th>English</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>你好。</td>\n<td>Nǐ hǎo.</td>\n<td>Ní hǎo. (nǐ becomes 2nd tone) (<a href=\"https://d1vq87e9lcf771.cloudfront.net/jiaoling/37bcad7a490df8f0d11ddbbd9f77fb65\">listen</a>)</td>\n<td>Hello.</td>\n</tr>\n<tr>\n<td>我的名字是Duo。</td>\n<td>Wǒde míngzi shì Duo.</td>\n<td>Wǒde míngzi shì Duo. (no rise in tone for wǒ) (<a href=\"https://d1vq87e9lcf771.cloudfront.net/jiaoling/b5ff52ec161bca3b2bc3c33683d460c1\">listen</a>)</td>\n<td>My name is Duo.</td>\n</tr>\n<tr>\n<td>我是Duo。</td>\n<td>Wǒ shì Duo.</td>\n<td>Wǒ shì Duo. (no rise in tone for wǒ) (<a href=\"https://d1vq87e9lcf771.cloudfront.net/jiaoling/7e463b2d7668bf02a1348a245bc3b7e0\">listen</a>)</td>\n<td>I am Duo.</td>\n</tr>\n</tbody>\n</table>",
from duolingo.
Here is a gist that does what I expect.
get_word_audio_url('你') outputs this url: 'https://d7mj4aqfscim2.cloudfront.net/tts/zs/jiaoling/你'
This requires the user to be logged in and assumes the requested language and word is in the users vocabulary. Without knowing more about the API, this is the best I could come up with in a couple hours. I've forked this package and will weave this in as I find time.
from duolingo.
Looks like your gist is no longer working, as there's no links in explanations anymore?
from duolingo.
This is fixed and tested now, closing ticket
from duolingo.
Related Issues (20)
- get_language_from_abbr() does not recognize ui_language
- how did you get vocabulary at first? HOT 1
- `get_daily_xp_progress` only fetch the last 300 lessons HOT 1
- get example sentences and tts via dictionary_page HOT 1
- points_rank no longer available HOT 8
- Request: Call to get daily XP totals for past 7 days HOT 10
- Module import breaks json.dumps()? HOT 2
- get_friends() HOT 1
- Question: anyway to get the explanation for all skills / topics
- JWT in session file not honored
- Part of the API seems to have been either removed or moved
- get_known_words Not returning all words HOT 1
- Cannot get urls for audio by using get_audio_url method HOT 1
- Leaderboad Doesn't Work HOT 4
- module 'duolingo' has no attribute 'Duolingo' HOT 4
- Translations stopped working today HOT 4
- 3rd Party Login HOT 5
- unable to login with api, no returns HOT 28
- Translations are Broken HOT 1
- Not able to fetch user data from `_get_data()` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from duolingo.