Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

fallleaves03

macrumors newbie
Original poster
Sep 23, 2013
2
0
I need help writing my first script (teaching myself) but can't figure out how to make the middle part work. Basically, this part is an auto copy/paste script and should retrieve a list of text from a specific website. The problem is that when I do the curl below it does not work because half of the list is hidden when the webpage is first opened. Normally when you open the website you need to click "get more info" to display the rest of the list.


The section of script:

set Features to "List of Features" & return

set startHere to "About this item" --the heading above the text I want from the website (inspect element= <div class="About">)

set stopHere to "<div style>" -- the string that shows up when I "inspect element" of the rest of the list and comes in between the two lists

set final to "<p>" -- what comes at the very end of the list I want in "inspect element"

set Features_list to (do shell script "curl http://www.openthispage.com | textutil -stdin -stdout -format html -convert txt -encoding UTF-8 ")

set AppleScript's text item delimiters to startHere
set ListTop to text item 2 of Features_list
set AppleScript's text item delimiters to stopHere
set A to text item 1 of ListTop
set delimeters to Final
set B to text item 2 of ListTop


set results to "RESULTS: " & Features & A & return & B
Returns error message "can't get text item 2 [of ListTop] of "Top of list on to text from the rest of the website"


How can I change the curl command line to look at the entire website data so it includes the "hidden" text when it finds and copies the list? Thank you for your help! And sorry there is a mixture of site text and "inspect element" data.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.