The one thing that frustrates many is the problem you have when you want to pass more than one Variable to an action. There are ways around it like saving to an external script.
But in this case a simple Applescript mixed with the bit of script @adayzdone gave you will get you what I think you want.
You just need to pass the list of URLs to this 'Run Applescript"
on run {input, parameters}
set docPath to POSIX path of (path to documents folder)
repeat with i from 1 to count of items of input
set this_item to item i of input
set thePage to (do shell script "curl " & quoted form of this_item)
set theTitle to docPath & "/" & (do shell script "echo " & quoted form of thePage & " | grep -o \\<title\\>.*\\</title\\> | sed -E 's/<\\/?title>//g'")
set t_text to (do shell script "echo " & quoted form of thePage & "|textutil -format html -convert txt -stdin -output \"" & theTitle & ".txt\"")
end repeat
end run
** Update for passing the text on to next action. **
This will pass a list of the text contents from all the URLS.
It will still do what the above does but will now pass a list of the text contents from all the URLS on to the next action.
I have tested it with 'Text to Speech and it reads multiple text content.
on run {input, parameters}
set docPath to POSIX path of (path to documents folder)
set bigList to {}
repeat with i from 1 to count of items of input
set this_item to item i of input
set thePage to (do shell script "curl " & quoted form of this_item)
set theTitle to docPath & "/" & (do shell script "echo " & quoted form of thePage & " | grep -o \\<title\\>.*\\</title\\> | sed -E 's/<\\/?title>//g'")
set t_text to (do shell script "echo " & quoted form of thePage & "|textutil -format html -convert txt -stdin -output \"" & theTitle & ".txt\"")
set t_text_for_action to (do shell script "echo " & quoted form of thePage & "|textutil -format html -convert txt -stdin -stdout")
copy t_text_for_action to end of bigList
end repeat
return bigList --> text list can now be passed to the next action
end run
If you want to test : may I suggest a page that has a small amount of text on tit like : http://www.javascripter.net/
Update 2 - Save text to audio file using the unix command 'say'.
Ok there are a couple of things here.
1, Because of the same reason I kept everything in one script in the previous codings. I have done the same here. i.e passing the text objects and titles together to the next Action would be a pain if not impossible.
2,The script uses the unix command and it's output option to save the text as an aiff file. It also names the file by the title.
3, I had a problem where instead of saving the file it started speaking the text. ??? This turned out that the URL I was testing on (http://www.javascripter.net) had a title tag that was in caps. so the @adayzdone grep and sed part of the script was returning "" . Which threw the say command.
I fixed this by using the -i ( ignore case ) option in the grep command and using the "|" ( or) option in sed and adding a caps version of the expression.
4, The Title being returned also had other characters in it that would cause a problem with the file being saved as a recognisable file by the system due to the extension not being added.
This is fixed by a simple handler that returns the title text with allowed characters.
6,
It works.
on run {input, parameters}
set docPath to POSIX path of (path to documents folder)
repeat with i from 1 to count of items of input
set this_item to item i of input
set thePage to (do shell script "curl -A \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30\" " & quoted form of this_item)
set theTitle to replaceBadChars((do shell script "echo " & quoted form of thePage & " | grep -io \\<title\\>.*\\</title\\> | sed -E 's/<\\/?title>|<\\/?TITLE>//g'"))
set t_text_for_action to (do shell script "echo " & quoted form of thePage & "|textutil -format html -convert txt -stdin -stdout")
do shell script "cd " & quoted form of docPath & " ;say -o \"" & theTitle & "\" , " & quoted form of t_text_for_action
end repeat
end run
on replaceBadChars(TEXT_)
log TEXT_
set OkChars to {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "_", space}
set TEXT_ to characters of TEXT_
repeat with i from 1 to count of items in TEXT_
set this_char to item i of TEXT_
if this_char is not in OkChars then
set item i of TEXT_ to "_"
else
end if
end repeat
set TEXT_ to TEXT_ as string
do shell script " echo " & quoted form of TEXT_
end replaceBadChars