View Single Post
Old 11-09-2023, 07:12 PM   #1697
meghane_e
Zealot
meghane_e juggles running chainsaws for a bit of light exercisemeghane_e juggles running chainsaws for a bit of light exercisemeghane_e juggles running chainsaws for a bit of light exercisemeghane_e juggles running chainsaws for a bit of light exercisemeghane_e juggles running chainsaws for a bit of light exercisemeghane_e juggles running chainsaws for a bit of light exercisemeghane_e juggles running chainsaws for a bit of light exercisemeghane_e juggles running chainsaws for a bit of light exercisemeghane_e juggles running chainsaws for a bit of light exercisemeghane_e juggles running chainsaws for a bit of light exercisemeghane_e juggles running chainsaws for a bit of light exercise
 
Posts: 116
Karma: 38500
Join Date: Sep 2016
Location: San Jose, CA
Device: Kindle moving to Kobo or Boox
Hi,
Sorry if this isn't a perfect place for this question but not sure where to start asking...
I'm a GR group mod for a Private Group. I'd like to download our group Bookshelf to keep track of books (because GR deletes or drops things), keep tags associated with books, when a book was entered and by whom. The normal things moderators like to keep track of and GR refuses to implement. Obviously I have an account.

I'm asking the following question here because I'm hoping programmers' experiences with the specific site will provide some tips. I wrote a working python app with the above functionality. It still works even though I use some older cookies & headers. I'm not honestly sure they're useful anymore. Usually, just being logged into my account lets my Python program work.

Code:
# secure values stripped
class GR_access:
...
cookies = { 'ccsid': '...', 'locale': 'en', '_session_id2': '...', 'blocking_sign_in_interstitial': 'true', 'u': '...', 'p': '...', 'likely_has_account': 'true', } headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:96.0) Gecko/20100101 Firefox/96.0', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8', 'Accept-Language': 'en-US,en;q=0.5', 'Accept-Encoding': 'gzip, deflate, br', 'Connection': 'keep-alive', 'Upgrade-Insecure-Requests': '1', 'Sec-Fetch-Dest': 'document', 'Sec-Fetch-Mode': 'navigate', 'Sec-Fetch-Site': 'none', 'Sec-Fetch-User': '?1', 'Cache-Control': 'max-age=0', 'If-None-Match': '...', }
response = requests.get(url, headers=GR_access.headers, cookies=GR_access.cookies)
Now, I need to rewrite this same functionality in Javascript for accessibility/reusability reasons. I tried the same cookies & headers in JavaScript script, even while logged into my Goodreads account in the same browser. I'm viewing the web browser's Web Developer Tools > Console output. The JavaScript I'm running gives me the following errors:
Code:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.goodreads.com/group/bookshelf/.... (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 404.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.goodreads.com/group/bookshelf/.... (Reason: CORS request did not succeed). Status code: (null).
The current headers & cookies look nothing like the old ones, so obviously things have changed. I can post more details if this is a good place to bring it to. Otherwise, where might there be a better forum for this?
Thank you for any pointers getting unstuck here!
meghane_e is offline   Reply With Quote