Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
782 views
in Technique[技术] by (71.8m points)

google sheets - ImportXML - Javascript? Imported content is empty

I'm trying to Import a field that helps indicate if a restaurant is currently accepting Online Orders or not.

=INDEX(IMPORTXML("https://www.doordash.com/store/yolk-test-kitchen-chicago-395338/en-US/?pickup=true","//div[@class='sc-cmIlrE bzKTjf']"),1)

I'm not sure why, but I think the data I'm looking for is possibly hidden due to javascript? Is there any way for me to retrieve this still with google sheets?

enter image description here

question from:https://stackoverflow.com/questions/65647284/importxml-javascript-imported-content-is-empty

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

IMPORTXML Imports data from any of various structured data types including XML, HTML, CSV, TSV, and RSS and ATOM XML feeds.

The data you are trying to import is loaded by script, therefore is not retrievable by IMPORTXML

I have tried to use the fetch(url) method from apps script and the page did not return the information you require.

If you go to Chrome Dev Tools and disable javascript you will see after reloading the page that no information is shown, that means that the entire page is loaded via script. You can do it by following Disable JavaScript With Chrome DevTools


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...