Request: Share text and alert pinyin
Hey all, just getting into shortcuts and I was trying to create one that allowed me to share chinese text, get the pinyin, and show it in an alert popup.
I started off with this site: https://hanzi-piny.in/# and made a shortcut where sharing chinese text would populate this url (e.g. https://hanzi-piny.in/#世界 output is niu yue with diacritics), and I tried to scrape the pinyin from the html output and pipe it into an alert. I found that it didn’t work as the site runs a script to generate the pinyin, so the pinyin wasn’t even present in the html at the time of scraping. Could any of you kind folks help me out, or provide some guidance?
Posted Apr 29, 2020, 9:01 PM UTC
From that link is not possible, I used another converter, this:
http://www.hipenpal.com/tool/chinese-simplified-and-traditional-characters-to-pinyin-converter-in-english.php
shortcut:
https://www.icloud.com/shortcuts/e078603d31a24f418edd7de5099d188a
Amazing, this is just what I was looking for, thanks!! One quick follow up, this breaks when you input a character that has multiple pronunciations — try 你着好 (zhe has parentheses that breaks up the result in html). Any ideas on how to fix?
Now it should work
https://www.icloud.com/shortcuts/55bd138d729d42dc9862fb87f2260b66
This didn’t fix it for me unfortunately... entering 你着好 results in: “nǐ zhe<span style=color:#aaaaaa>(zháo,zhúo)</span> hǎo”
Entering just 着 also gives me ”zhe<span style=color:#aaaaaa>(zháo,zhúo)</span>”
Any idea what’s going on? I noticed that the “Contains” condition is highlighted in red, so maybe the new code is never executing. Appreciate your help very much!
strange to me it works by inserting 你 着 好 and also 着
https://i.imgur.com/JWF8MZh.png
i used this
https://www.icloud.com/shortcuts/ce325ad2976a49e99c69aa4bf11029bc