在GoogleSheet上,我需要在这个页面上爬行亚马逊的股价(跟随xPath):https://www.boursorama.com/cours/AMZN/
//*[@id="main-content"]/div/section[1]/header/div/div/div[1]/div[1]/div/div[1]/span[1]--我可以用这个公式做,它可以工作:
IMPORTXML("https://www.boursorama.com/cours/AMZN/", "//*[@id=""main-content""]/div/section[1]/header/div/div/div[1]/div[1]/div/div[1]/span[1]")但是,IMPORTXML函数有一个日常的局限性。
因此,为了避免谷歌的日常限制,我需要使用,所以应该是这样的:
=REGEXEXTRACT(QUERY(TRANSPOSE(IMPORTDATA(
"https://www.boursorama.com/cours/AMZN/"));
"where Col1 contains 'basp:""'");"(\d+.*)""") <-- here is the line where something is wrong我不习惯和REGEX一起工作,有人能帮我吗?
发布于 2022-08-26 21:34:02
尝试:
=REGEXREPLACE(QUERY(FLATTEN(IMPORTDATA(
"https://www.boursorama.com/cours/AMZN")),
"where Col1 contains 'data-ist-bid-price>'", 0),
"</?\S+[^<>]*>", )*1

https://stackoverflow.com/questions/73499541
复制相似问题