1

如果我想提取所有演员的名字,我试过这个,但它只提取一个名字。是否有重复循环或其他任何我可以做的事情来让它拉出所有说的标签<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
4

1 回答 1

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'")
于 2012-11-21T00:21:24.533 回答