devnoname120 / google-play-book-downloader

Download and decrypt books purchased on Google Play Books without text reflowing
GNU Affero General Public License v3.0
54 stars 4 forks source link

Error! Couldn't find a download link for x pages #16

Closed sushmitxo closed 5 months ago

sushmitxo commented 7 months ago

I edited the google-play-book-downloader-pdf.mjs and the edited part looks like this:

const BOOK_ID = '1Iy8EAAAQBAJ'; // Found in the URL of the book page. For example: BwCMEAAAQBAJ
const GOOGLE_PAGE_DOWNLOAD_PACER = 2 * 1000; // Wait between requests to reduce risk of getting flagged for abuse.

// How to get this options object:
// 1) Go to https://play.google.com/books and login.
// 2) Open dev console, network tab.
// 3) Click somewhere in the page.
// 4) Right-click on the corresponding request in the dev console and then “Copy as Node.js fetch”.
// 5) Options object is the second argument in the call to fetch().
const FETCH_OPTIONS = {
  "headers": {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/116.0",
    "Accept": "*/*",
    "Accept-Language": "en-US,en;q=0.5",
}
};

Then, I ran: npx zx google-play-book-downloader-pdf.mjs but, getting this error. Also the url "https://play.google.com/books/publisher/content?id=1Iy8EAAAQBAJ&pg=PP1&img=1&zoom=3&hl=en&sig=[REDACTED]" returns the correct image of the book:

[1Iy8EAAAQBAJ] Script started
[1Iy8EAAAQBAJ] Found AES decryption key: [REDACTED]
[1Iy8EAAAQBAJ] Extracted the table of contents to toc.json
[1Iy8EAAAQBAJ] Wrote human-readable table of contents to toc.txt
[1Iy8EAAAQBAJ] Error! Couldn't find a download link for 300 pages (89% missing, total: 337 pages). Make sure that the FETCH_OPTIONS object is valid and that you own the book. List of missing pages: [PA23,PA24,PA25,PA26,PA27,PA28,PA29,PA30,PA31,PA32,PA33,PA34,PA35,PA36,PA37,PA38,PA39,PA40,PA41,PA42,PA43,PA44,PA45,PA46,PA47,PA48,PA49,PA50,PA51,PA52,PA53,PA54,PA55,PA56,PA57,PA58,PA59,PA60,PA61,PA62,PA63,PA64,PA65,PA66,PA67,PA68,PA69,PA70,PA71,PA72,PA73,PA74,PA75,PA76,PA77,PA78,PA79,PA80,PA81,PA82,PA83,PA84,PA85,PA86,PA87,PA88,PA89,PA90,PA91,PA92,PA93,PA94,PA95,PA96,PA97,PA98,PA99,PA100,PA101,PA102,PA103,PA104,PA105,PA106,PA107,PA108,PA109,PA110,PA111,PA112,PA113,PA114,PA115,PA116,PA117,PA118,PA119,PA120,PA121,PA122,PA123,PA124,PA125,PA126,PA127,PA128,PA129,PA130,PA131,PA132,PA133,PA134,PA135,PA136,PA137,PA138,PA139,PA140,PA141,PA142,PA143,PA144,PA145,PA146,PA147,PA148,PA149,PA150,PA151,PA152,PA153,PA154,PA155,PA156,PA157,PA158,PA159,PA160,PA161,PA162,PA163,PA164,PA165,PA166,PA167,PA168,PA169,PA170,PA171,PA172,PA173,PA174,PA175,PA176,PA177,PA178,PA179,PA180,PA181,PA182,PA183,PA184,PA185,PA186,PA187,PA188,PA189,PA190,PA191,PA192,PA193,PA194,PA195,PA196,PA197,PA198,PA199,PA200,PA201,PA202,PA203,PA204,PA205,PA206,PA207,PA208,PA209,PA210,PA211,PA212,PA213,PA214,PA215,PA216,PA217,PA218,PA219,PA220,PA221,PA222,PA223,PA224,PA225,PA226,PA227,PA228,PA229,PA230,PA231,PA232,PA233,PA234,PA235,PA236,PA237,PA238,PA239,PA240,PA241,PA242,PA243,PA244,PA245,PA246,PA247,PA248,PA249,PA250,PA251,PA252,PA253,PA254,PA255,PA256,PA257,PA258,PA259,PA260,PA261,PA262,PA263,PA264,PA265,PA266,PA267,PA268,PA269,PA270,PA271,PA272,PA273,PA274,PA275,PA276,PA277,PA278,PA279,PA280,PA281,PA282,PA283,PA284,PA285,PA286,PA287,PA288,PA289,PA290,PA291,PA292,PA293,PA294,PA295,PA296,PA297,PA298,PA299,PA300,PA301,PA302,PA303,PA304,PA305,PA306,PA307,PA308,PA309,PA310,PA311,PA312,PA313,PA314,PA315,PA316,PA317,PA318,PA319,PA320,PA321,PA322]
[1Iy8EAAAQBAJ] Starting to download 337 pages…
[1Iy8EAAAQBAJ] [1/337] Error! Download or decrypt failed (url: https://play.google.com/books/publisher/content?id=1Iy8EAAAQBAJ&pg=PP1&img=1&zoom=3&hl=en&sig=[REDACTED]) failed with The operation failed for an operation-specific reason
OperationError: The operation failed for an operation-specific reason
    at AESCipherJob.onDone (node:internal/crypto/util:420:19)
    at AESCipherJob.callbackTrampoline (node:internal/async_hooks:130:17)
[1Iy8EAAAQBAJ] [2/337] Error! Download or decrypt failed (url: https://play.google.com/books/publisher/content?id=1Iy8EAAAQBAJ&pg=PR1&img=1&zoom=3&hl=en&sig=[REDACTED]) failed with The operation failed for an operation-specific reason
OperationError: The operation failed for an operation-specific reason
    at AESCipherJob.onDone (node:internal/crypto/util:420:19)
    at AESCipherJob.callbackTrampoline (node:internal/async_hooks:130:17)
and more.....
duffy6 commented 6 months ago

I have the same issue! Any news in this case?

currythecoder commented 5 months ago

In my experience, you need to select the "Copy as Fetch (NodeJS)" option (different from "Copy as Fetch"). There's a lot more data copied, such the header containing an item called "cookie" with a big slab of text. Unfortunately, it doesn't seem to be an available option in Firefox, only in Chromium browsers.

vladrevers commented 5 months ago

Now I noticed the same thing. If you open the link https://play.google.com/books/volumes/${BOOK_ID}/manifest in the same browser window (by substituting id), you can see that there are no links for these pages.

devnoname120 commented 5 months ago

@vladrevers As far as I understand it's a different issue: See: https://github.com/devnoname120/google-play-book-downloader/issues/7

devnoname120 commented 5 months ago

This issue is due to the user not copying the fetch object correctly. See: https://github.com/devnoname120/google-play-book-downloader/issues/16#issuecomment-2039051847