Last active
August 29, 2015 14:24
-
-
Save yarwelp/03a04741d6fa1f43a96a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
curl "$1" 2>/dev/null \ | |
| xmlstarlet fo -H --omit-decl 2>/dev/null \ | |
| xmlstarlet sel -H -t -v "//*[@class='digital-product ']/@data-product-id" 2>/dev/null | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ugly extraction of product id out of Packt Publishing ugly HTML. Example:
./packtpub-id.bash https://www.packtpub.com/game-development/webgl-beginners-guide
I use these ID's in the catalog listing at http://www.erikano.net/eBooks/given-to-me.htm for books I have gotten through https://www.packtpub.com/packt/offers/free-learning.
The ID is also present in the "My eBooks" section of Packt Publishing so from now on, I type the ID manually. The script made it a bit easier to add ID's for books I had already listed.