My task involves accessing multiple accounts on Amazon's KDP platform, which can be found at
To login to each account and check their earnings, I rely on Mechanize for handling the cookies. However, the page displaying the earnings uses Javascript to populate dynamically.
I've discovered that the Javascript sends out a specific request:
https://kdp.amazon.com/self-publishing/reports/transactionSummary?_=1326419839161&marketplaceID=ATVPDKIKX0DER
Each time I view the results, the numerical part of the URL changes, even if it's the same link. This poses a challenge in extracting the required information from the response.
The browser receives a lengthy response to the request, containing relevant data such as earnings and book titles. Analyzing the source code reveals intricate scripts running on the page, making it difficult to decipher how these requests are generated.
Is there a way to track and emulate these requests using Mechanize while bypassing the complexities of the Javascripts?
Any insights or suggestions would be greatly appreciated.
Note: To ensure efficiency, Watir is not considered suitable for this task due to its limitations when handling large volumes of accounts.