def _parse_search_result(self, result: Dict, generic_cover: str, locale: str) -> MetaRecord: match = MetaRecord( id=result["id"], title=result["volumeInfo"]["title"], authors=result["volumeInfo"].get("authors", []), url=Google.BOOK_URL + result["id"], source=MetaSourceInfo( id=self.__id__, description=Google.DESCRIPTION, link=Google.META_URL, ), ) match.cover = self._parse_cover(result=result, generic_cover=generic_cover) match.description = result["volumeInfo"].get("description", "") match.languages = self._parse_languages(result=result, locale=locale) match.publisher = result["volumeInfo"].get("publisher", "") match.publishedDate = result["volumeInfo"].get("publishedDate", "") match.rating = result["volumeInfo"].get("averageRating", 0) match.series, match.series_index = "", 1 match.tags = result["volumeInfo"].get("categories", []) match.identifiers = {"google": match.id} match = self._parse_isbn(result=result, match=match) return match
def parse_single_book(self, match: MetaRecord, generic_cover: str, locale: str) -> MetaRecord: response = requests.get(match.url) self.root = fromstring(response.text) match.cover = self._parse_cover(generic_cover=generic_cover) match.description = self._parse_description() match.languages = self._parse_languages(locale=locale) match.publisher = self._parse_publisher() match.publishedDate = self._parse_from_summary( attribute_name="datePublished") match.rating = self._parse_rating() match.series, match.series_index = self._parse_series() match.tags = self._parse_tags() match.identifiers = { "isbn": self._parse_isbn(), "lubimyczytac": match.id, } return match