API that allows for Full Text Search on any Book based on isbn to get the number of results of a word or phrase
I have tried looking at both the Google Books API as well as the Amazon Product Search API to try to find a way to return the number of words matching within a search.
I know that it would be possible to scrape this data as I can easily access this from a webpage, but I do not wish to do a scrape to get this data.
The screenshots below show results for the word "doom", within the book "Masters of Doom", on both Google Books and Amazon.Amazon
I have searched far and wide for a way to do this. I don't care the technology, as long as it is an official API from a company that has access to this data. I will add more details later as to my searching so far:
I have tried a workaround using the custom search API - it doesn't allow for searching on books.google.com (will provide source if needed).
This is not opinion based. I just want a technology that will solve the problem. I just need 1, factual way to accomplish this.
See also questions close to this topic
-
Amazon Product Search API - I can't able to get more then 50 results in AWS
Using AmazonECS api liberery,i getting result by searching keywords and category.In Every api call, i passing itempage value so i can get products records.But when i pass itempage value 6 them AWS gives this error :
stdClass Object ( [OperationRequest] => stdClass Object ( [HTTPHeaders] => stdClass Object ( [Header] => stdClass Object ( [Name] => UserAgent [Value] => PHP-SOAP/5.6.20 ) ) [RequestId] => bd687619-fbb4-4e44-9d6a-6b11f8af6358 [Arguments] => stdClass Object ( [Argument] => stdClass Object ( [Name] => Service [Value] => AWSECommerceService ) ) [RequestProcessingTime] => 0.001033235 ) [Items] => stdClass Object ( [Request] => stdClass Object ( [IsValid] => False [ItemSearchRequest] => stdClass Object ( [BrowseNode] => 16310211 [ItemPage] => 6 [Keywords] => spiceology [ResponseGroup] => Large [SearchIndex] => All ) [Errors] => stdClass Object ( [Error] => stdClass Object ( [Code] => AWS.ParameterOutOfRange [Message] => The value you specified for ItemPage is invalid. Valid values must be between 1 and 5. ) ) ) ) )
In First call response,there are showing 65 records and total 7 pages available.so how can i get all this records by passing page id.I can't able to get more records.
stdClass Object ( [OperationRequest] => stdClass Object ( [HTTPHeaders] => stdClass Object ( [Header] => stdClass Object ( [Name] => UserAgent [Value] => PHP-SOAP/5.6.20 ) ) [RequestId] => 928e0ef7-4acf-4f4e-b962-e8d4c79745bf [Arguments] => stdClass Object ( [Argument] => stdClass Object ( [Name] => Service [Value] => AWSECommerceService ) ) [RequestProcessingTime] => 0.141871669 ) [Items] => stdClass Object ( [Request] => stdClass Object ( [IsValid] => True [ItemSearchRequest] => stdClass Object ( [ItemPage] => 1 [Keywords] => spiceology [ResponseGroup] => Large [SearchIndex] => All ) ) [TotalResults] => 65 [TotalPages] => 7
-
'price_and_currency' method in Python's Amazon Simple Product API returns "Decimal"
I'm calling the Amazon Product API using Amazon Simple Product API Module (Python):
product = amazon.lookup(ItemId="B00H2VOSP8")
When returning
return str(product.price_and_currency)
I get the following:(Decimal('149.95'), 'USD')
The official documentation indicates I should be getting
('149.95', 'USD')
How can I correct this?
-
How to filter products on Amazon Product Advertising API
I'm working with Amazon Product Advertising API as I said in the title. I'm trying to find a way to have a better product filtering. I know (and I tested that) the classic filters method as by using keywords, Nodes or PowerSearch.
What I'm searching right now is how to make a deep search in a specific branch.
For example, on Amazon Websites is possible filtering Laptops by their RAM size, Weight, Hard Drive Type (check the image for a better understand) and a lot of other things.
Is it possible to have the same filtering opportunities by using Amazon Product Advertising API (and I miss to read the resources) or not?
If not, there is some other way to accomplish this?
Thanks!
-
Foreach loop returns null after 10th iteration
I used the Google Books Api through .NET. and with MVC Core 2. I retrieve an IEnumerable of data and by a simple foreach loop iteration, I assign every book to a book object inside a list. Here is the code which I customized from here.
public IEnumerable<Book> GetBooks(string query, int offset, int count) { var queryList = _booksService.Volumes.List(query); queryList.MaxResults = count; queryList.StartIndex = offset; var result = queryList.Execute(); if (result != null) { var books = result.Items.Select(b => new Book { // id = b.Id, title = b.VolumeInfo.Title, subtitle = b.VolumeInfo.Subtitle, authors = string.Join(",",b.VolumeInfo.Authors), publisher = b.VolumeInfo.Publisher, publishedDate = b.VolumeInfo.PublishedDate, description = b.VolumeInfo.Description, pageCount = (int)b.VolumeInfo.PageCount, category = string.Join(",",b.VolumeInfo.Categories), maturityRating = b.VolumeInfo.MaturityRating, language = b.VolumeInfo.Language, smallThumbnail = b.VolumeInfo.ImageLinks.SmallThumbnail, thumbnail = b.VolumeInfo.ImageLinks.Thumbnail }).ToList(); return books; } else { return null; } }
It was working fine before, but now, after the 10th iteration I get a "InvalidOperationException: Nullable object must have a value." in my View, in the following line:
var books = result.Items.Select(b => new Book
This is very weird, because the debugger shows that the request executed succesfully and I get results for this.
What could possible have gone wrong? Thanks in advance.
-
Google Books API Swift searching for books using title and/or author
I am trying to search for books by typing in the title, author or both. Doing just the title would work. I'm not sure why it wouldn't work. URLs work when enter them on the web. Any advice or help would be appreciated. It is due midnight.
Here is code for view controller with text fields
import UIKit import Foundation class ViewController: UIViewController, UITextFieldDelegate { @IBOutlet weak var bookTitleTextField: UITextField! @IBOutlet weak var authorTextField: UITextField! var book: String = "" var author: String = "" var titles = [String]() override func viewDidLoad() { super.viewDidLoad() bookTitleTextField.delegate = self authorTextField.delegate = self } func textFieldShouldReturn(_ textField: UITextField) -> Bool { bookTitleTextField.resignFirstResponder() authorTextField.resignFirstResponder() return true; } func initializeTextFields() { bookTitleTextField.delegate = self bookTitleTextField.keyboardType = UIKeyboardType.default authorTextField.delegate = self authorTextField.keyboardType = UIKeyboardType.default } @IBAction func searchButton(_ sender: UIButton) { var query = "" if book == bookTitleTextField.text!, !book.isEmpty { query = book } if author == authorTextField.text!, !author.isEmpty { if (!query.isEmpty) { query += "+" } query += "inauthor:\(author)" } var urlComps = URLComponents(string: "https://www.googleapis.com/books/v1/volumes?")! urlComps.queryItems = [URLQueryItem(name: "q", value: query)] let session: URLSession = { let config = URLSessionConfiguration.default return URLSession(configuration: config) }() //urlComps.queryItems = queryItems as [URLQueryItem] let request = URLRequest(url: urlComps.url!) let task = session.dataTask(with: request) { (data, response, error) -> Void in if let jsonData = data { if let jsonString = try? JSONSerialization.jsonObject(with: jsonData, options: []) { let arrayOfTitles = (jsonString as AnyObject).value(forKeyPath: "items.volumeInfo.title") as? [String] if let items = arrayOfTitles { self.titles = items } DispatchQueue.main.async { self.performSegue(withIdentifier: "findTitles", sender: self) } } } else if let requestError = error { print("Error fetching books \(requestError)") } else { print("Unexpected error with the request") } } task.resume() } override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { bookTitleTextField.resignFirstResponder() authorTextField.resignFirstResponder() } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if (segue.identifier == "findTitles") { if let destinationVC = segue.destination as? BookSearchView { destinationVC.books = titles } } } }
Here is code for displaying using table view
import UIKit import Foundation class BookSearchView: UITableViewController { var books: [String] = [] override func viewDidLoad() { super.viewDidLoad() } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) tableView.reloadData() } override func numberOfSections(in tableView: UITableView) -> Int { return 1 } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return books.count } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) cell.textLabel?.text = books[indexPath.row] return cell } }
-
How to search for a book by author/title in swift using Google Books API
I am trying to get a book by entering a title or author or both. There is a textfield for title and one for author. It works when I enter just a title but can't get the others to work. When I enter the urls on web they work but do not show up in a table view for some reason. Below is the code for my search button.
I just need it to work when I enter just a name in just author textfield or enter both a title and author in both textfields.
Any advice or help would be appreciated. Maybe there is another way to do this. It is due tonight at midnight. Thanks!
var booksURL: URL? if book == bookTitleTextField.text! && author == authorTextField.text! { book = bookTitleTextField.text! author = authorTextField.text! let urlComps = NSURLComponents(string: "https://www.googleapis.com/books/v1/volumes?q=" + book + "+inauthor:" + author)! booksURL = urlComps.url! } if book == bookTitleTextField.text! && author != authorTextField.text! { book = bookTitleTextField.text! author = "" let urlComps = NSURLComponents(string: "https://www.googleapis.com/books/v1/volumes?q=" + book)! booksURL = urlComps.url! } else { book = bookTitleTextField.text ?? "" } if author == authorTextField.text! && book != bookTitleTextField.text! { author = authorTextField.text! book = "" let urlComps = NSURLComponents(string: "https://www.googleapis.com/books/v1/volumes?q=inauthor:" + author)! booksURL = urlComps.url! } else { author = authorTextField.text ?? "" } let request = URLRequest(url: booksURL!) let task = session.dataTask(with: request) { (data, response, error) -> Void in if let jsonData = data { if let jsonString = try? JSONSerialization.jsonObject(with: jsonData, options: []) { let arrayOfTitles = (jsonString as AnyObject).value(forKeyPath: "items.volumeInfo.title") as? [String] if let items = arrayOfTitles { self.titles = items } DispatchQueue.main.async { self.performSegue(withIdentifier: "findTitles", sender: self) } } } else if let requestError = error { print("Error fetching books \(requestError)") } else { print("Unexpected error with the request") } } task.resume()