chbrown / overdrive

Bash script to download mp3s from the OverDrive audiobook service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

License is invalid Error

devucsb opened this issue · comments

On MacOS

user@MBP Audiobooks % overdrive download HackingGrowthHowTodaysFastestGrowingCompaniesD-630.odm --verbose
Entering debug (verbose) mode
+ CURLOPTS=("${CURLOPTS[@]:1}")
+ shift
+ [[ 0 -gt 0 ]]
+ [[ 1 -eq 0 ]]
+ [[ 1 -eq 0 ]]
+ HEADER_PRINTED=
+ for ODM in '"${MEDIA[@]}"'
+ for COMMAND in '"${COMMANDS[@]}"'
+ case $COMMAND in
+ download HackingGrowthHowTodaysFastestGrowingCompaniesD-630.odm
+ license_path=HackingGrowthHowTodaysFastestGrowingCompaniesD-630.odm.license
+ acquire_license HackingGrowthHowTodaysFastestGrowingCompaniesD-630.odm HackingGrowthHowTodaysFastestGrowingCompaniesD-630.odm.license
+ [[ -e HackingGrowthHowTodaysFastestGrowingCompaniesD-630.odm.license ]]
++ uuidgen
++ tr '[:lower:]' '[:upper:]'
+ ClientID=C426F217-3A9C-4C7A-9B1F-A490C0E7D77F
+ printf 'Generating random ClientID=%s\n' C426F217-3A9C-4C7A-9B1F-A490C0E7D77F
Generating random ClientID=C426F217-3A9C-4C7A-9B1F-A490C0E7D77F
++ xmllint --xpath '/OverDriveMedia/License/AcquisitionUrl/text()' HackingGrowthHowTodaysFastestGrowingCompaniesD-630.odm
+ AcquisitionUrl=https://ofs.contentreserve.com/MP3LicenseAcquisitionService.svc/e610fc69-54f9-4ce5-aa85-acad00e8cf8c
+ printf 'Using AcquisitionUrl=%s\n' https://ofs.contentreserve.com/MP3LicenseAcquisitionService.svc/e610fc69-54f9-4ce5-aa85-acad00e8cf8c
Using AcquisitionUrl=https://ofs.contentreserve.com/MP3LicenseAcquisitionService.svc/e610fc69-54f9-4ce5-aa85-acad00e8cf8c
++ xmllint --xpath 'string(/OverDriveMedia/@id)' HackingGrowthHowTodaysFastestGrowingCompaniesD-630.odm
+ MediaID=12be9ca6-db3c-4013-a000-fce166918282-425
+ printf 'Using MediaID=%s\n' 12be9ca6-db3c-4013-a000-fce166918282-425
Using MediaID=12be9ca6-db3c-4013-a000-fce166918282-425
+ RawHash='C426F217-3A9C-4C7A-9B1F-A490C0E7D77F|1.2.0|10.11.6|ELOSNOC*AIDEM*EVIRDREVO'
+ printf 'Using RawHash=%s\n' 'C426F217-3A9C-4C7A-9B1F-A490C0E7D77F|1.2.0|10.11.6|ELOSNOC*AIDEM*EVIRDREVO'
Using RawHash=C426F217-3A9C-4C7A-9B1F-A490C0E7D77F|1.2.0|10.11.6|ELOSNOC*AIDEM*EVIRDREVO
++ echo -n 'C426F217-3A9C-4C7A-9B1F-A490C0E7D77F|1.2.0|10.11.6|ELOSNOC*AIDEM*EVIRDREVO'
++ iconv -f ASCII -t UTF-16LE
++ openssl dgst -binary -sha1
++ base64
+ Hash=/tHikPT0xw1zmVW9B3KunnyXxEA=
+ printf 'Using Hash=%s\n' /tHikPT0xw1zmVW9B3KunnyXxEA=
Using Hash=/tHikPT0xw1zmVW9B3KunnyXxEA=
+ curl -L -A 'OverDrive Media Console' --compressed 'https://ofs.contentreserve.com/MP3LicenseAcquisitionService.svc/e610fc69-54f9-4ce5-aa85-acad00e8cf8c?MediaID=12be9ca6-db3c-4013-a000-fce166918282-425&ClientID=C426F217-3A9C-4C7A-9B1F-A490C0E7D77F&OMC=1.2.0&OS=10.11.6&Hash=/tHikPT0xw1zmVW9B3KunnyXxEA='
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   286    0   286    0     0    729      0 --:--:-- --:--:-- --:--:--   729
++ cat HackingGrowthHowTodaysFastestGrowingCompaniesD-630.odm.license
+ printf 'Using License=%s\n' '<LicenseError xmlns="http://license.overdrive.com/2008/03/LicenseError.xsd" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><ErrorCode>1003</ErrorCode><ErrorMessage>The requested license is either invalid or already acquired</ErrorMessage><ErrorDetails i:nil="true"/></LicenseError>'
Using License=<LicenseError xmlns="http://license.overdrive.com/2008/03/LicenseError.xsd" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><ErrorCode>1003</ErrorCode><ErrorMessage>The requested license is either invalid or already acquired</ErrorMessage><ErrorDetails i:nil="true"/></LicenseError>
++ xmllint --xpath '//*[local-name()="ClientID"]/text()' HackingGrowthHowTodaysFastestGrowingCompaniesD-630.odm.license
XPath set is empty
+ ClientID=
user@MBP Audiobooks % 
```

thanks in advance!

Not entirely sure what went wrong where, but Overdrive refused to give you a valid license when requested in the acquire_license step. I can't do any better than that error message:

The requested license is either invalid or already acquired

Can you try turning it off and back on again? 😜 - I.e., rm HackingGrowthHowTodaysFastestGrowingCompaniesD* and then go re-download a fresh ODM file from your library's website and re-run the overdrive download ... command 🤞

(And in case you were wondering, each time you download the ODM file it is slightly different — precisely at the point where your process failed — the AcquisitionUrl value)

Thanks for the helpful response! That solved it!