Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 11-20-2010, 10:19 AM   #1
miwie
Connoisseur
miwie began at the beginning.
 
Posts: 76
Karma: 12
Join Date: Nov 2010
Device: Android, PB Pro 602
Get value of "<img src="x..." for cover

A newspaper holds thumbnails for every edition on a gallery page.

How can I fetch the value of an "<img src="..."> (inside a specific "<div class="XXX">") in "get_cover_url(self)" to get this image file as cover image.

Michael

Last edited by miwie; 11-20-2010 at 10:21 AM.
miwie is offline   Reply With Quote
Old 11-20-2010, 11:24 AM   #2
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by miwie View Post
A newspaper holds thumbnails for every edition on a gallery page.

How can I fetch the value of an "<img src="..."> (inside a specific "<div class="XXX">") in "get_cover_url(self)" to get this image file as cover image.

Michael
Code:
        def get_cover_url(self):
            cover_url = None
            index = 'http://some.where.com/some-page'
            soup = self.index_to_soup(index)
            link_item = soup.find('div',attrs={'class':'XXX'})
            if link_item:
               cover_url = link_item.img['src']
            return cover_url
Starson17 is offline   Reply With Quote
Advert
Old 11-20-2010, 11:47 AM   #3
miwie
Connoisseur
miwie began at the beginning.
 
Posts: 76
Karma: 12
Join Date: Nov 2010
Device: Android, PB Pro 602
Thanks!

Works the way I want.
miwie is offline   Reply With Quote
Old 11-22-2010, 11:50 AM   #4
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by miwie View Post
Thanks!

Works the way I want.
You're welcome.
Starson17 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
element "img" not allowed in this context graniton Calibre 5 05-14-2012 11:39 PM
"Settings," then "311" - Int'l Kindle searches for wireless providers in the area Dr. Drib Amazon Kindle 2 08-28-2011 10:27 AM
Yep. It's official. Sony Reader has "ruined" books for me. A final "review." WilliamG Sony Reader 48 01-14-2011 03:49 AM
Woher bekomme ich "Infinite Jest" oder "Unendlicher Spaß" von David Foster Wallace? bitschnau Erste Hilfe 3 11-01-2010 01:22 PM
My DIY cover for the Kobo - the "KoBook" (or "BooKobo") Beorn Kobo Reader 4 07-12-2010 07:06 PM


All times are GMT -4. The time now is 06:58 PM.


MobileRead.com is a privately owned, operated and funded community.