在Applescript中返回HTML解析后,如何使引号正确格式化?

在Applescript中返回HTML解析后,如何使引号正确格式化?,applescript,Applescript,我正在使用此代码从网站上调用描述: set astid to AppleScript's text item delimiters set startHere to "<div id=\"doc-original-text\" itemprop=\"description\">" set stopHere to "</div>" set mysource_html to do shell script "curl https://play.google.com/stor

我正在使用此代码从网站上调用描述:

set astid to AppleScript's text item delimiters

set startHere to "<div id=\"doc-original-text\" itemprop=\"description\">"
set stopHere to "</div>"
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
blurb2
如何使引号格式正确为
,而不是
'有一些有用的功能来编码/解码文本

set astid to AppleScript's text item delimiters

set startHere to "<div id=\"doc-original-text\" itemprop=\"description\">"
set stopHere to "</div>"
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
tell application "ASObjC Runner" to set blurb3 to modify string blurb2 so it is unencoded for XML
将astid设置为AppleScript的文本项分隔符
将startHere设置为“”
将stopHere设置为“”
将mysource_html设置为执行shell脚本“curl”https://play.google.com/store/movies/details?id=H9EKG4-JHSw“
将AppleScript的文本项分隔符设置为startHere
将blurb1设置为mysource_html的文本项2
将AppleScript的文本项分隔符设置为stop here
将blurb2设置为blurb1的文本项1
将AppleScript的文本项分隔符设置为astid
告诉应用程序“ASObjC Runner”设置blurb3以修改字符串blurb2,使其不编码为XML
或者,您可以继续使用文本项分隔符:

set astid to AppleScript's text item delimiters

set startHere to "<div id=\"doc-original-text\" itemprop=\"description\">"
set stopHere to "</div>"
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 "&#39;"
set blurb2 to text items of blurb2
set AppleScript's text item delimiters to "'"
set blurb2 to blurb2 as text
set AppleScript's text item delimiters to astid
将astid设置为AppleScript的文本项分隔符
将startHere设置为“”
将stopHere设置为“”
将mysource_html设置为执行shell脚本“curl”https://play.google.com/store/movies/details?id=H9EKG4-JHSw“
将AppleScript的文本项分隔符设置为startHere
将blurb1设置为mysource_html的文本项2
将AppleScript的文本项分隔符设置为stop here
将blurb2设置为blurb1的文本项1
将AppleScript的文本项分隔符设置为“';”
将blurb2设置为blurb2的文本项
将AppleScript的文本项分隔符设置为“'”
将blurb2设置为blurb2作为文本
将AppleScript的文本项分隔符设置为astid

谢谢!有没有办法不使用外部应用程序就通过vanilla Applescript运行它?我刚下载了程序,代码不起作用。它被“修改字符串”卡住了,说“预期结束”,我相信你必须在它工作之前启动一次ASObjC Runner。第二个不返回任何内容。第一个不是一直编译的,太好了。。。第二个脚本也可以工作,只需在末尾添加return blurb2即可查看变量的值
set astid to AppleScript's text item delimiters

set startHere to "<div id=\"doc-original-text\" itemprop=\"description\">"
set stopHere to "</div>"
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 "&#39;"
set blurb2 to text items of blurb2
set AppleScript's text item delimiters to "'"
set blurb2 to blurb2 as text
set AppleScript's text item delimiters to astid