Hi everyone!
Is it possible to fetch data from http://www.pogdesign.co.uk/cat/next-airing Like when the next episode airs, that episode its name, which hour it will air, and maybe the short info about it ?(when you click on the + ). At least the airdate and the name. If the others are possible too, that would be very cool!
set ShowName to text returned of (display dialog "For which show do you want a forecast?" default answer "")
set NextEpisode to do shell script "curl http://www.pogdesign.co.uk/cat/next-airing | grep -i '" & ShowName & "'"
is what I have so far, but I’m approaching it wrong, it gets the data that I don’t need, text above the needed information.
Thanks
Hi,
Quick & dirty “hard-coded”
property output : ""
set ShowName to text returned of (display dialog "For which show do you want a forecast?" default answer "")
set NextEpisode to do shell script "curl [url=http://www.pogdesign.co.uk/cat/next-airing]http://www.pogdesign.co.uk/cat/next-airing"[/url]
set {TID, text item delimiters} to {text item delimiters, "alt=\"View upcoming episodes for " & ShowName & "\""}
try
set N to text item 3 of NextEpisode
set text item delimiters to ";\">+ "
set N to text item 1 of N
set text item delimiters to ";\">"
set N to text items of N
set text item delimiters to TID
set output to ShowName & return & return
set {TID, text item delimiters} to {text item delimiters, ">"}
set D to text items of item 7 of N
set text item delimiters to "<"
set output to appendOutput(text item 1 of item 2 of D)
set output to appendOutput(text item 1 of item 4 of D)
repeat with i from 3 to 5
set output to appendOutput(text item 1 of item i of N)
end repeat
set text item delimiters to TID
display dialog output
on error number N
if N is -128 then return
display dialog "unknown show"
end try
on appendOutput(t)
return output & t & return
end appendOutput
Thanks
This will give me a start
I thought one would use grep & sed because it would be easier.
But what I don’t understand is, when leave
out of the script, and run the script more than once with, it will append information with the previous generated information. I can simply add
but I don’t see why it won’t work without…
The property line doesn’t reinitialize the variable in most cases,
so it’s recommended to set it always to a defined state
OK, I thought that the property would be set to “” every time because otherwise it would be a global. But I don’t see why that line is required, the output variable is set to something else later on anyway. But I’ll just go with adding
set output to ""
at the end of the script.