Announcement

Collapse
No announcement yet.

Also need scraping assistance

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Also need scraping assistance

    I am trying to get the data for "surf" into a device string. What is the best way to accomplish this. I have been fooling around with it all day, but I would like to know the real way to do it. Thanks.

    <TR>
    <TD bgcolor="#d7ecff"><IMG SRC="http://image.weather.com/web/blank.gif" WIDTH="1" HEIGHT="2" BORDER="0" ALT=""></TD>
    <TD bgcolor="#d7ecff"><IMG SRC="http://image.weather.com/web/blank.gif" WIDTH="1" HEIGHT="2" BORDER="0" ALT=""></TD>
    <TD bgcolor="#d7ecff" class="captionText" align="left"><FONT COLOR="#214486">Surf:</FONT></TD>
    <TD bgcolor="#d7ecff" class="captionText" align="left"><FONT COLOR="#214486">Waist-high</FONT></TD>
    <TD bgcolor="#d7ecff"><IMG SRC="http://image.weather.com/web/blank.gif" WIDTH="1" HEIGHT="2" BORDER="0" ALT=""></TD>
    <TD bgcolor="#d7ecff"><IMG SRC="http://image.weather.com/web/blank.gif" WIDTH="1" HEIGHT="2" BORDER="0" ALT=""></TD>
    </TR>

    Basically, I would like device B40 to read "Waist High". This value can change.

    #2
    Beach,

    What is the URL where the chunk of data you posted comes from?

    Comment


      #3
      Joe,

      It comes from weather.com. I posted the relevant part.

      Comment


        #4
        Beach,

        I can't help you unless you let me know the URL where this came from.

        If you don't want to post it then search for Surf: first and then from there search for 486"> to find the starting position. From there search for </ to get the end position.

        This assumes there is no other Surf: in the web page preceding the one you posted (the reason I need the URL) This also assumes the web page formatting doesn't change which would break the code.

        Comment


          #5
          Joe,

          Here is the page:

          http://www.weather.com/outlook/recre...TenDayForecast

          Comment


            #6
            Beach,

            Your script is attached. Have fun.

            Cheers,
            Attached Files

            Comment


              #7
              Hey Joe, Thanks for taking the time to do that. I tried it, and it works, but it is not returning the value I want. I want the state of the surf, ie "waist high" to be populated in the device code. As you wrote it, it populated "surf:". I tried to edit it by changing the ending value, and it works, but it has funny characters at the end. Maybe I did something wrong. Thanks.

              Comment


                #8
                Beach,

                You have B40 setup as a virtual device? I tried the script on my PC and it works fine (i.e The status of B40 = Waist-high) Take the comment out for the hs.writelog near the bottom of the script and see what it logs. It should say debug Waist-high.

                Comment


                  #9
                  Joe,

                  Now it works. I can't explain why it didn't work the first time. Do you have a tutorial or an explanation of what each line in the script does? I would like to know so that I can make some of these myself. I can guess, but I want to be sure so I don't make a mistake. I was trying to parse from the tutorial on coocoon, but I think I like your way better. Thanks again.

                  Comment


                    #10
                    If you want more info, the boat & beach information is availiable from the weather channel in an XML form.
                    it will give you 3 days of surf / seas forcast also broken up into morning, afternoon, evening and night.

                    an example of forcast for the next few hours or in this case part n (night) of day 0
                    <pre class="ip-ubbcode-code-pre"> - &lt;day d="0" t="Thursday" dt="Oct 7"&gt;
                    - &lt;part p="N"&gt;
                    &lt;seat&gt;67&lt;/seat&gt;
                    &lt;t&gt;Light&lt;/t&gt;
                    &lt;surf&gt;Calm&lt;/surf&gt;
                    - &lt;wind&gt;
                    &lt;s&gt;5&lt;/s&gt;
                    &lt;gust&gt;N/A&lt;/gust&gt;
                    &lt;d&gt;241&lt;/d&gt;
                    &lt;t&gt;WSW&lt;/t&gt;
                    &lt;/wind&gt;
                    &lt;seas&gt;Very smooth&lt;/seas&gt;
                    &lt;/part&gt;
                    &lt;/day&gt;
                    </pre>

                    It's a free service. and you can sign up at
                    http://registration.weather.com/regi...n/xmloap/step1
                    once you're signed up, just put "/07720?bnb=3" as the last part of the address and it will return everything you need, in a format that won't change

                    Comment


                      #11
                      Wes,

                      This seems great, but I can't seem to find the xml page you are referring to. I am signed up. Do I have to log in somewhere and then type in a web address?

                      Comment


                        #12
                        You'll have to replace the [partner id] and the [liscence key] with the apporopriate info

                        http://xoap.weather.com/weather/local/07720?bnb=3&prod=xoap&par=[partner_id]&key=[license_key]

                        other things you can do in place ( or in addition to) of the bnb=3 are
                        cc=* - current conditions
                        hbhf=40 - hour by hour forcast for up to the next 40 hours
                        dayf=10 - daily forcast for up to the next 10 days

                        you can do multiple things like

                        cc=*&dayf=5&bnb=3

                        although it will make getting through the data a little more difficult simply because there's more of it

                        Comment

                        Working...
                        X