Applescript to remove all text not between two strings -


i'm trying make script displays dialog of current itunes top 20. how intend html code top 100 website , extract text between 2 strings name of song. first song, extremely successful.

however, works first song each time. way can think of fix rather get between 2 strings, delete not between them. give me song names string.

does know how this?

get html:

set curlcommand "curl https://www.apple.com/itunes/charts/songs/" set html (do shell script curlcommand)  

get song name:

set applescript's text item delimiters "width=\"100\" height=\"100\" alt=\"" set thetext item 2 of every text item of html set applescript's text item delimiters "\"></a>" set thetext item 1 of every text item of thetext set applescript's text item delimiters "" 

you use shell list song names line line (this not applescript list).

set charts (do shell script " curl -s 'https://www.apple.com/itunes/charts/songs/'| tr '\"' '\n' |awk '/^ alt=$/ {getline;print}'") 

tr '\"' '\n' substitutes double quotes new lines (tr manual page)

awk '/^ alt=$/ {getline;print}' prints line after line alt= song name written (awk manual page)


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -