Re: [nokogiri-talk] Parsing problem, classes at same level, can only get one.

15 views
Skip to first unread message

Mike Dalessio

unread,
Aug 10, 2017, 1:01:39 PM8/10/17
to nokogiri-talk
Can you print out the parsed document structure (desc_page.to_html) to ensure it matches the original document structure?

On Thu, Aug 10, 2017 at 5:20 AM, Ben Edwards <list...@gmail.com> wrote:
I am have the folowing  ocde

desc_page = Nokogiri::HTML( HTTParty.get( 'http://www.cubecinema.com/programme/event/curtis-ellers-american-circus,9454' ) )
title_array.push(       desc_page.css("h3").text )
description_array.push( desc_page.css(".copy").text )
when_array.push(        desc_page.css(".showing").text )

Now both the copy class and showing class are at the same level but only
description_array is populayed with text.
when_array is

[1] pry(main)> when_array
=> ["", "", "", "", "", "", "", "", ""]
[2] pry(main)> description_array

HTML segmaent is

           <div class="grid-item grid-item--width3" style="position: absolute; left: 40.4624%; top: 0px;">
                <p></p><h3>Curtis Eller's American Circus</h3><p></p>
               
                <p class="showings">
                -<br>
                   
                   
                   
                   
                        Wed 6 September // 20:00
                   
                   
                   
                    <br>
                   
                </p>
               
                    <p class="tickets">Tickets: £8</p>
               
               
                   <p class="action"><a href="http://www.bristolticketshop.co.uk/?/170906CUBCURT1" target="_blank">Book tickets</a></p>
               
                <div class="copy">
                    <p>A welcome return from 'New York's angriest
yodelling banjo player' Curtis Eller. With songs about circus fires,
pigeon racing and heroes, Curtis' biggest musical influences are Buster
Keaton, Elvis Presley and Abraham Lincoln. Yodelling and some strong
language can be expected.&nbsp;</p>
With support from Le Ton Mité; McCloud Zicmuse, who has collaborated
with members of Deerhoof and A Hawk and a Hacksaw, revisits and explores
 his American homeland through new album Passé Composé Futur
Conditionnel.
                </div><!-- end .copy -->
            </div><!-- end .grid-item -->

Verry odd :(

Ben





--
You received this message because you are subscribed to the Google Groups "nokogiri-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nokogiri-talk+unsubscribe@googlegroups.com.
To post to this group, send email to nokogi...@googlegroups.com.
Visit this group at https://groups.google.com/group/nokogiri-talk.
For more options, visit https://groups.google.com/d/optout.

Ben Edwards

unread,
Aug 10, 2017, 3:55:52 PM8/10/17
to nokogiri-talk
I worked it out, I had showing, should of been
showings.  I missed out the s.

Not come across the to_html, looks very usefull.

where is the docs for the methods, cant seem to find them.

Ben




Reply all
Reply to author
Forward
0 new messages