View Single Post
Old 09-12-2012, 05:48 PM   #826
ilovejedd
hopeless n00b
ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.
 
ilovejedd's Avatar
 
Posts: 5,110
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
Quote:
Originally Posted by JimmXinu View Post
No, it's still on the 'wishlist' of things I may do some day. As I recall, I looked into it once and found that it would require restructuring the code more than I wanted tackle that day. Especially as I'd only ever heard from one user asking for it. Now that it's two users, I'll revisit it sometime.
If it'll take too much work, forget about it. I actually happen to like the leading chapter numbers and thought the reason I'm not getting it is because you had implemented the above. Apparently, the reason I'm not seeing them is because the site adapter doesn't parse it.

From adapter_dramioneorg.py, the code for getting the chapter url and chapter titles appear to be as follows:

Code:
        # Find the chapters:
        for chapter in soup.findAll('a', href=re.compile(r'viewstory.php\?sid='+self.story.getMetadata('storyId')+"&chapter=\d+$")):
            # just in case there's tags, like <i> in chapter titles.
            self.chapterUrls.append((stripHTML(chapter),'http://'+self.host+'/'+chapter['href']+addurl))
The actual HTML code looks like this:
Code:
<tr><td>1. <a href="viewstory.php?sid=1331&amp;chapter=1">December 2010: Five Minutes 'til Christmas</a>  <span class="cnotes"><span class="cnotes"><p>My first drabble ever!</p>
<p>Drabbles are supposed to be exactly 100 words long, and often have a prompt word or phrase to use as inspiration. It is a great exercise for new and experienced authors alike.</p>
<p>This particular drabble is rated G, and is quite fluffy, really.</p>
<p>Enjoy!</p>
<p>Prompt: <i>a </i><i>gift</i></p>
</span></span></td><td class="center"><a href="reviews.php?type=ST&amp;item=1331&amp;chapid=4326">1</a> </td><td class="center">90</td><td class="center">412</td></tr>
What changes do I need to make to the adapter code to include the chapter number instead of just getting the title inside the link?

Thanks!
ilovejedd is offline