Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seems google wants a secure http request now #6

Closed
tadaspetra opened this issue Apr 1, 2021 · 4 comments
Closed

Seems google wants a secure http request now #6

tadaspetra opened this issue Apr 1, 2021 · 4 comments

Comments

@tadaspetra
Copy link

From what I see it is still able to retrieve most of the data, only the image URL is not able to be retrieved.

Screen Shot 2021-03-31 at 8 16 30 PM

When I manually update the URL to use https instead of http it works fine.

Screen Shot 2021-03-31 at 8 22 47 PM

@bdlukaa
Copy link
Owner

bdlukaa commented Apr 1, 2021

The URL scheme can be changed using the URI class. A example:

Uri url = book.imageLinks['coverImage'];
if (url.isScheme('http')) url = Uri.parse(book.imageLinks['coverImage'].replaceAll('http//:', 'https//:'));

@tadaspetra
Copy link
Author

Yea that is a bit cleaner than what I did, but would it be better to do that within the package?

@bdlukaa
Copy link
Owner

bdlukaa commented Apr 2, 2021

This was implemented in version 4.1.0. With the property reschemeImageLinks, you can automatically rescheme the image links. It defaults to false

Example:

void main(List<String> args) async {
  final books = await queryBooks(
    'twilight',
    maxResults: 3,
    printType: PrintType.books,
    orderBy: OrderBy.relevance,
    reschemeImageLinks: true,
  );
  books.forEach((book) {
    final info = book.info;
    print('$info\n');
  });
}

@bdlukaa bdlukaa closed this as completed Apr 2, 2021
@tadaspetra
Copy link
Author

Awesome! Works great! Thanks you 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants