-
Notifications
You must be signed in to change notification settings - Fork 679
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
Is it normal normal that the program can't login after 10 minutes? #346
Comments
It seems that the login function has a problem. I need to used cookie instead: #150 (comment) |
Me too. It looks like the website's login page has changed? [19/Aug/2023 08:41:00] Logging into Safari Books Online...
|
As a workarround you can still use cookie auth |
I'm getting the same issues, and for some reason the instructions on the #150 aren't working for me in chrome or firefox. |
I pulled with chrome no dice, I pulled with firefox and now I'm getting this error: [24/Aug/2023 14:23:44] ** Welcome to SafariBooks! ** ----> cookie set info here <----- Found. Redirecting to https://www.oreilly.com/accounts/login-academic-ch eck/?next=https%3A%2F%2Flearning.oreilly.com%2Fprofile%2F I started over completely, pulled the latest repo, and get this error using the cookies.json file. |
I was following the #150 but get error below using chrome: |
Hitting the same issue, so added some output to see what's going on.
Getting browser cookies as suggested in #150 doesn't help in this case. I have downloaded a number of books before this started happening, but I would expect to get something like Too Many Requests if I have exceeded some limits 🤷 |
@lijie-jiang I ran into the same problem. After comparing the cookie I got from #150 with the previous one I had, I found the actual content is wrapped inside another layer.
and also extra
at the end. |
This felt weird, so I looked into the code a bit today. It sent the request to Not sure what's wrong, but here are a few pointers to check:
{
"_abck":"XXXXX",
"_dd_s":"XXXXX",
"_evga_5802":"XXXXX",
"_ga":"XXXXX",
"_ga_4WZYL59WMV":"XXXXX",
"_gat_UA-112091926-1":"XXXXX",
"_gid":"XXXXX",
"_sfid_472e":"XXXXX",
"ak_bmsc":"XXXXX",
"akaalb_LearningALB":"XXXXX",
"AMP_49f7a68a85":"XXXXX",
"AMP_MKTG_49f7a68a85":"XXXXX",
"bm_sv":"XXXXX",
"bm_sz":"XXXXX",
"groot_sessionid":"XXXXX",
"OptanonAlertBoxClosed":"XXXXX",
"OptanonConsent":"XXXXX",
"orm-jwt":"XXXXX",
"orm-rt":"XXXXX"
}
|
O'Reilly implemented https://www.akamai.com/products/bot-manager on their site, the cookies needed after login for authentication are orm-jwt and orm-rt. And I think also groot_sessionid. |
Hello,
Thanks, it works. Firefox should be used.
Lukáš Vavrek ***@***.***>于2023年9月1日 周五23:19写道:
[-] Logging into Safari Books Online...
[*] Sending request to
https://learning.oreilly.com/login/unified/?next=/home/:
This felt weird, so I looked into the code a bit today. It sent the
request to https://learning.oreilly.com/profile/ and then straight to
https://learning.oreilly.com/api/v1/book/XXXXXXXX/. It then proceeded
with downloading the book.
Not sure what's wrong, but here are a few pointers to check:
1. execute a program like python3 safaribooks.py XXXXXXXX (without the
--cred argument)
2. cookies.json content is not a 1:1 copy of Firefox's 'Copy All'
output. Only put the Request Cookies value there, i.e.:
{
"_abck":"XXXXX",
"_dd_s":"XXXXX",
"_evga_5802":"XXXXX",
"_ga":"XXXXX",
"_ga_4WZYL59WMV":"XXXXX",
"_gat_UA-112091926-1":"XXXXX",
"_gid":"XXXXX",
"_sfid_472e":"XXXXX",
"ak_bmsc":"XXXXX",
"akaalb_LearningALB":"XXXXX",
"AMP_49f7a68a85":"XXXXX",
"AMP_MKTG_49f7a68a85":"XXXXX",
"bm_sv":"XXXXX",
"bm_sz":"XXXXX",
"groot_sessionid":"XXXXX",
"OptanonAlertBoxClosed":"XXXXX",
"OptanonConsent":"XXXXX",
"orm-jwt":"XXXXX",
"orm-rt":"XXXXX"
}
—
Reply to this email directly, view it on GitHub
<#346 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABGHU5JDT63NA6JQXC6C7ELXYH4HZANCNFSM6AAAAAA3W2BPWQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Best Regareds,
Lijie Jang
|
This worked for me too, thank you @lukasvavrek! It bypasses the login request and plows on. Should the default behaviour be to use the existing cookies file? Could also add a |
I pulled the cookies using firefox, put them in a cookies.json, and when I do python3 safaribooks.py I get this: [#] Unhandled Exception: too many values to unpack (expected 2) (type: ValueError) I'm glad it's working for some people, just not sure what I'm doing wrong at this point. I verified I have the latest clone of the repo as well. |
@digitalw00t make sure that you modify your |
The the lazy, here's a quick python converter from the json export: #!/usr/bin/env python3
import json
# Define the input file name
input_file = "sample.json" # Replace with the actual file name
# Define a dictionary to store the converted data
converted_data = {}
# Read data from the input JSON file
try:
with open(input_file, 'r') as file:
data = json.load(file)
except FileNotFoundError:
print(f"Error: File '{input_file}' not found.")
exit(1)
except json.JSONDecodeError:
print(f"Error: Invalid JSON format in '{input_file}'.")
exit(1)
# Iterate through each JSON object in the data
for entry in data:
name_raw = entry.get("Name raw", "")
content_raw = entry.get("Content raw", "")
# Check if both name_raw and content_raw exist
if name_raw and content_raw:
converted_data[name_raw] = content_raw
# Display the converted data to the screen
print(json.dumps(converted_data, indent=2)) |
Just put the contents in sample.json or whatever you wanna change the filename to, and bam. It's working now btw. |
Out of curiosity, with all the cookies from the site, how do you know those cookies specifically are the ones that are required? |
Hello folks, thanks everyone for the support. I really love this community ❤️
|
The second one, at the beginning ;-) |
For the first one, we'd have to understand how the login mechanism even works,which I honestly don't. |
Here's a python script to convert the Cookie header value to json:
usage:
|
For anyone suffering this issue, can take a look this PR #350 and apply the patch |
I did everything as instructed and downloaded the program but It stayed in this screen for almost 10 minutes? Is this behaviour normal if not how can I fix it?
![Screenshot 2023-08-20 at 00 33 30](https://private-user-images.githubusercontent.com/139978263/261821129-5ad325e3-0e82-4199-b430-affc2b7b0aee.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MDY5MTksIm5iZiI6MTcyNDUwNjYxOSwicGF0aCI6Ii8xMzk5NzgyNjMvMjYxODIxMTI5LTVhZDMyNWUzLTBlODItNDE5OS1iNDMwLWFmZmMyYjdiMGFlZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODI0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyNFQxMzM2NTlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1jZDI3MjcxZGFhNDRmYTViYTkzNzc5ODRlNzQyMzg2ZmIwMWI4YTFmZTkwMzM0ZDQ5NjkzNWExNWQxYTA1NjJmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.jiWsZM5hYQN6HT3vP5w2fBoJzeFf3TkKIt0AZDQ5-Sw)
The text was updated successfully, but these errors were encountered: