mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-11-03 19:17:02 -05:00 
			
		
		
		
	Get Books; Fix price not being displayed for books from Amazon dues to website changes
This commit is contained in:
		
							parent
							
								
									f086a48a4a
								
							
						
					
					
						commit
						687c0b9c05
					
				@ -4,7 +4,7 @@
 | 
			
		||||
 | 
			
		||||
from __future__ import (unicode_literals, division, absolute_import,
 | 
			
		||||
                        print_function)
 | 
			
		||||
store_version = 3  # Needed for dynamic plugin loading
 | 
			
		||||
store_version = 4  # Needed for dynamic plugin loading
 | 
			
		||||
 | 
			
		||||
from contextlib import closing
 | 
			
		||||
import urllib
 | 
			
		||||
@ -66,7 +66,7 @@ def search_amazon(query, max_results=10, timeout=60,
 | 
			
		||||
            cover_xpath =  "descendant-or-self::img[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-access-image ')]/@src"
 | 
			
		||||
            title_xpath = "descendant-or-self::h2[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-access-title ')]//text()"
 | 
			
		||||
            author_xpath = './/span[starts-with(text(), "by ")]/following-sibling::span//text()'
 | 
			
		||||
            price_xpath = '(.//span[contains(@class, " s-price ")])[last()]//text()'
 | 
			
		||||
            price_xpath = 'descendant::span[contains(@class, "sx-price")]/../@aria-label'
 | 
			
		||||
        else:
 | 
			
		||||
            return
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,7 @@
 | 
			
		||||
 | 
			
		||||
from __future__ import (unicode_literals, division, absolute_import,
 | 
			
		||||
                        print_function)
 | 
			
		||||
store_version = 5  # Needed for dynamic plugin loading
 | 
			
		||||
store_version = 6  # Needed for dynamic plugin loading
 | 
			
		||||
 | 
			
		||||
from contextlib import closing
 | 
			
		||||
import urllib
 | 
			
		||||
@ -66,7 +66,7 @@ def search_amazon(query, max_results=10, timeout=60,
 | 
			
		||||
            cover_xpath =  "descendant-or-self::img[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-access-image ')]/@src"
 | 
			
		||||
            title_xpath = "descendant-or-self::h2[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-access-title ')]//text()"
 | 
			
		||||
            author_xpath = './/span[starts-with(text(), "by ")]/following-sibling::span//text()'
 | 
			
		||||
            price_xpath = '(.//span[contains(@class, " s-price ")])[last()]//text()'
 | 
			
		||||
            price_xpath = 'descendant::span[contains(@class, "sx-price")]/../@aria-label'
 | 
			
		||||
        else:
 | 
			
		||||
            return
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,7 @@
 | 
			
		||||
 | 
			
		||||
from __future__ import (unicode_literals, division, absolute_import,
 | 
			
		||||
                        print_function)
 | 
			
		||||
store_version = 13  # Needed for dynamic plugin loading
 | 
			
		||||
store_version = 14  # Needed for dynamic plugin loading
 | 
			
		||||
 | 
			
		||||
from contextlib import closing
 | 
			
		||||
import urllib
 | 
			
		||||
@ -68,7 +68,7 @@ def search_amazon(query, max_results=10, timeout=60,
 | 
			
		||||
            cover_xpath =  "descendant-or-self::img[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-access-image ')]/@src"
 | 
			
		||||
            title_xpath = "descendant-or-self::h2[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-access-title ')]//text()"
 | 
			
		||||
            author_xpath = './/span[starts-with(text(), "%s ")]/following-sibling::span//text()' % BY
 | 
			
		||||
            price_xpath = '(.//span[contains(@class, " s-price ")])[last()]//text()'
 | 
			
		||||
            price_xpath = 'descendant::span[contains(@class, "sx-price")]/../@aria-label'
 | 
			
		||||
        else:
 | 
			
		||||
            return
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,7 @@
 | 
			
		||||
 | 
			
		||||
from __future__ import (unicode_literals, division, absolute_import,
 | 
			
		||||
                        print_function)
 | 
			
		||||
store_version = 13  # Needed for dynamic plugin loading
 | 
			
		||||
store_version = 14  # Needed for dynamic plugin loading
 | 
			
		||||
 | 
			
		||||
from contextlib import closing
 | 
			
		||||
import urllib
 | 
			
		||||
@ -68,7 +68,7 @@ def search_amazon(query, max_results=10, timeout=60,
 | 
			
		||||
            cover_xpath =  "descendant-or-self::img[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-access-image ')]/@src"
 | 
			
		||||
            title_xpath = "descendant-or-self::h2[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-access-title ')]//text()"
 | 
			
		||||
            author_xpath = './/span[starts-with(text(), "%s ")]/following-sibling::span//text()' % BY
 | 
			
		||||
            price_xpath = '(.//span[contains(@class, " s-price ")])[last()]//text()'
 | 
			
		||||
            price_xpath = 'descendant::span[contains(@class, "sx-price")]/../@aria-label'
 | 
			
		||||
        else:
 | 
			
		||||
            return
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,7 @@
 | 
			
		||||
 | 
			
		||||
from __future__ import (unicode_literals, division, absolute_import,
 | 
			
		||||
                        print_function)
 | 
			
		||||
store_version = 13  # Needed for dynamic plugin loading
 | 
			
		||||
store_version = 14  # Needed for dynamic plugin loading
 | 
			
		||||
 | 
			
		||||
from contextlib import closing
 | 
			
		||||
import urllib
 | 
			
		||||
@ -68,7 +68,7 @@ def search_amazon(query, max_results=10, timeout=60,
 | 
			
		||||
            cover_xpath =  "descendant-or-self::img[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-access-image ')]/@src"
 | 
			
		||||
            title_xpath = "descendant-or-self::h2[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-access-title ')]//text()"
 | 
			
		||||
            author_xpath = './/span[starts-with(text(), "%s ")]/following-sibling::span//text()' % BY
 | 
			
		||||
            price_xpath = '(.//span[contains(@class, " s-price ")])[last()]//text()'
 | 
			
		||||
            price_xpath = 'descendant::span[contains(@class, "sx-price")]/../@aria-label'
 | 
			
		||||
        else:
 | 
			
		||||
            return
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,7 @@
 | 
			
		||||
 | 
			
		||||
from __future__ import (unicode_literals, division, absolute_import,
 | 
			
		||||
                        print_function)
 | 
			
		||||
store_version = 3  # Needed for dynamic plugin loading
 | 
			
		||||
store_version = 4  # Needed for dynamic plugin loading
 | 
			
		||||
 | 
			
		||||
from contextlib import closing
 | 
			
		||||
import urllib
 | 
			
		||||
@ -66,7 +66,7 @@ def search_amazon(query, max_results=10, timeout=60,
 | 
			
		||||
            cover_xpath =  "descendant-or-self::img[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-access-image ')]/@src"
 | 
			
		||||
            title_xpath = "descendant-or-self::h2[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-access-title ')]//text()"
 | 
			
		||||
            author_xpath = './/span[starts-with(text(), "by ")]/following-sibling::span//text()'
 | 
			
		||||
            price_xpath = '(.//span[contains(@class, " s-price ")])[last()]//text()'
 | 
			
		||||
            price_xpath = 'descendant::span[contains(@class, "sx-price")]/../@aria-label'
 | 
			
		||||
        else:
 | 
			
		||||
            return
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,7 @@
 | 
			
		||||
 | 
			
		||||
from __future__ import (unicode_literals, division, absolute_import,
 | 
			
		||||
                        print_function)
 | 
			
		||||
store_version = 13  # Needed for dynamic plugin loading
 | 
			
		||||
store_version = 14  # Needed for dynamic plugin loading
 | 
			
		||||
 | 
			
		||||
from contextlib import closing
 | 
			
		||||
import urllib
 | 
			
		||||
@ -68,7 +68,7 @@ def search_amazon(query, max_results=10, timeout=60,
 | 
			
		||||
            cover_xpath =  "descendant-or-self::img[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-access-image ')]/@src"
 | 
			
		||||
            title_xpath = "descendant-or-self::h2[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-access-title ')]//text()"
 | 
			
		||||
            author_xpath = './/span[starts-with(text(), "%s ")]/following-sibling::span//text()' % BY
 | 
			
		||||
            price_xpath = '(.//span[contains(@class, " s-price ")])[last()]//text()'
 | 
			
		||||
            price_xpath = 'descendant::span[contains(@class, "sx-price")]/../@aria-label'
 | 
			
		||||
        else:
 | 
			
		||||
            return
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,7 @@
 | 
			
		||||
 | 
			
		||||
from __future__ import (unicode_literals, division, absolute_import,
 | 
			
		||||
                        print_function)
 | 
			
		||||
store_version = 13  # Needed for dynamic plugin loading
 | 
			
		||||
store_version = 14  # Needed for dynamic plugin loading
 | 
			
		||||
 | 
			
		||||
from contextlib import closing
 | 
			
		||||
import urllib
 | 
			
		||||
@ -66,7 +66,7 @@ def search_amazon(query, max_results=10, timeout=60,
 | 
			
		||||
            cover_xpath =  "descendant-or-self::img[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-access-image ')]/@src"
 | 
			
		||||
            title_xpath = "descendant-or-self::h2[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-access-title ')]//text()"
 | 
			
		||||
            author_xpath = './/span[starts-with(text(), "by ")]/following-sibling::span//text()'
 | 
			
		||||
            price_xpath = '(.//span[contains(@class, " s-price ")])[last()]//text()'
 | 
			
		||||
            price_xpath = 'descendant::span[contains(@class, "sx-price")]/../@aria-label'
 | 
			
		||||
        elif 'grid' in results.get('class', ''):
 | 
			
		||||
            data_xpath = '//div[contains(@class, "prod")]'
 | 
			
		||||
            format_xpath = (
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,7 @@
 | 
			
		||||
 | 
			
		||||
from __future__ import (unicode_literals, division, absolute_import,
 | 
			
		||||
                        print_function)
 | 
			
		||||
store_version = 13  # Needed for dynamic plugin loading
 | 
			
		||||
store_version = 14  # Needed for dynamic plugin loading
 | 
			
		||||
 | 
			
		||||
from contextlib import closing
 | 
			
		||||
import urllib
 | 
			
		||||
@ -66,7 +66,7 @@ def search_amazon(query, max_results=10, timeout=60,
 | 
			
		||||
            cover_xpath =  "descendant-or-self::img[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-access-image ')]/@src"
 | 
			
		||||
            title_xpath = "descendant-or-self::h2[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-access-title ')]//text()"
 | 
			
		||||
            author_xpath = './/span[starts-with(text(), "by ")]/following-sibling::span//text()'
 | 
			
		||||
            price_xpath = '(.//span[contains(@class, " s-price ")])[last()]//text()'
 | 
			
		||||
            price_xpath = 'descendant::span[contains(@class, "sx-price")]/../@aria-label'
 | 
			
		||||
        else:
 | 
			
		||||
            return
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user