【发布时间】:2021-04-28 08:45:27
【问题描述】:
我正在尝试从网页https://www.worldcoinindex.com/获取加密名称、价格和百分比的数据
如何通过以下脚本获取 % 列值?
set theHtml to do shell script "curl -s " & quoted form of "https://www.worldcoinindex.com"
set text item delimiters to {"<tbody>", "</tbody>"}
set tableContents to theHtml's text item 2 # item 2 is the body of the price table
set text item delimiters to {"<h2>"} # site uses new h2 for each currency
set tableChunks to tableContents's text items 2 thru -1
set pasteStr to ""
repeat with aChunk in tableChunks
set text item delimiters to "><span>$ </span><span class=\"span\">"
tell aChunk's text item 1 to set {theSymbol, thePrice} to {first word, last word}
set pasteStr to pasteStr & theSymbol & tab & thePrice & return
end repeat
set the clipboard to pasteStr
【问题讨论】:
-
感谢您迄今为止所拥有的一切。你可以在每一行中使用
percentage的类名吗?
标签: applescript