如果我想拉出所有演员的名字,我试过这个,但它只拉一个名字。是否有重复循环或其他任何我可以做的事情来让它拉出所有标记<span itemprop="name">
?
set astid to AppleScript's text item delimiters
set startHere to "<span itemprop=\"name\">"
set stopHere to "</span>"
set mysource_html to do shell script "curl https://play.google.com/store/movies/details?id=H9EKG4-JHSw"
set AppleScript's text item delimiters to startHere
set blurb1 to text item 2 of mysource_html
set AppleScript's text item delimiters to stopHere
set blurb2 to text item 1 of blurb1
set AppleScript's text item delimiters to astid
答案 0 :(得分:1)
尝试:
set {TID, text item delimiters} to {text item delimiters, {"<td class=\"credit-label\">Actors</td>", "<td class=\"credit-label\">Producers</td>"}}
set mysource_html to text item 2 of (do shell script "curl https://play.google.com/store/movies/details?id=H9EKG4-JHSw")
set text item delimiters to TID
set mysource_html to every paragraph of (do shell script "echo " & quoted form of mysource_html & " | grep -Eo '<span itemprop=\"name\">[^<]*' | sed 's/.*>//g'")