I want to scrap the phonetic guide for a translation in Google Translator using Google Sheets.
For instance, if you enter the page:
https://translate.google.com/#view=home&op=translate&sl=auto&tl=zh-CN&text=欢迎你
…you will see a transliteration of 欢迎你
into Huānyíng nǐ (Welcome!)
. I want to extract only the transliteration. (Huānyíng nǐ
). If I inspect the Web page code I see that this sentence is stored into:
<div class="tlid-transliteration-content transliteration-content full">Huānyíng nǐ</div>
…so I tried to extract this transliteration using IMPORTXML
typing the following code:
=importxml("https://translate.google.com/#view=home&op=translate&sl=auto&tl=zh-CN&text=欢迎你";"//div[@class='tlid-transliteration-content transliteration-content full']")
But the result is #N/A
. It's supposed to be that //div[@class='name-of-the-element']"
would do the trick. Where is the error? How can I import this specific result?