Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
780 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 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...