07-16-2012, 07:43 AM | #1 |
Groupie
Posts: 154
Karma: 10
Join Date: May 2012
Device: Kindle Paperwhite2
|
captureing all articles but all under the first section
Here is how the webpage looks like
Code:
<div class='module'> <h3>Section1</h3> <ul> <li> <h4>articles links and article titles</h4> </li> ……(other articles) </ul> <h3>Section2</h3> <ul> <li> <h4>articles links and article titles</h4> </li> …… (other articles) </ul> But it turned out that though all the articles were fetched correctly, they all end up in the first section.But I am at a loss what to do, since all section names are included in "h3", and unlike webpage of built-in recipes, <div class='module'> appears only before the first section, not every section (which I think explains the failure). Can anyone help me out? Just a quick answer is appreciated. Last edited by Steven630; 07-19-2012 at 03:52 AM. |
07-17-2012, 12:10 AM | #2 |
Groupie
Posts: 154
Karma: 10
Join Date: May 2012
Device: Kindle Paperwhite2
|
I think it has something to do with section.find('h3') this only find the first one. But when I changed this to section.findAll('h3') , it failed to fetch anything (not even the first section).
|
07-17-2012, 01:44 AM | #3 |
Groupie
Posts: 154
Karma: 10
Join Date: May 2012
Device: Kindle Paperwhite2
|
Just edited the thread starter to reflect a string I didn't mention.
|
07-18-2012, 09:40 AM | #4 |
Groupie
Posts: 154
Karma: 10
Join Date: May 2012
Device: Kindle Paperwhite2
|
I changed the recipe and made every single "ul" as a section, leaving out section title. This time, Calibre correctly divided articles into several sections. But the drawback is that each section has no name. I'm thinking about grabbing h3 and add those to section names. Is that possible? Or can I just enter the section name in the recipe one by one?
|
07-19-2012, 01:18 AM | #5 |
creator of calibre
Posts: 43,859
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
When you find a ul use ul.findPreviousSibling('h3') to get the title. Read the beautifulsoup documentation, it will teach you how to do this, and many other things.
|
07-19-2012, 02:10 AM | #6 |
Groupie
Posts: 154
Karma: 10
Join Date: May 2012
Device: Kindle Paperwhite2
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Kindle Fire: also missing "section/articles" in all news | mkgtu | Devices | 3 | 11-21-2011 10:14 AM |
What do you think I would ask for in this section? | Saras | Which one should I buy? | 4 | 01-20-2011 03:15 PM |
cant seem to keep my articles! | marbs | Recipes | 2 | 11-18-2010 12:56 PM |
PRS-600 Articles like this | scottjl | Sony Reader | 31 | 12-30-2009 05:41 AM |