{"id":562,"date":"2016-12-15T13:21:04","date_gmt":"2016-12-15T12:21:04","guid":{"rendered":"http:\/\/hamsterhirn.de\/?p=562"},"modified":"2017-03-15T21:00:01","modified_gmt":"2017-03-15T20:00:01","slug":"download-from-vitalsource","status":"publish","type":"post","link":"https:\/\/hamsterhirn.de\/index.php\/2016\/12\/download-from-vitalsource\/","title":{"rendered":"download from vitalsource"},"content":{"rendered":"<p>login and save session cookie:<br \/>\n<pre><code class=\"preserve-code-formatting\">wget --keep-session-cookies --user-agent=Mozilla\/5.0 --save-cookies cookies.txt --post-data &#039;user%5Bemail%5D=someone%40someplace.com&amp;amp;user%5Bpassword%5D=asdf&amp;amp;return=https%3A%2F%2Fevantage.gilmoreglobal.com%2F%23%2F&amp;amp;failure=https%3A%2F%2Fevantage.gilmoreglobal.com%2F%23%2Fuser%2Fsignin%2Ffailure%2Fsomeone%2540someplace.com&amp;amp;jigsaw_brand=evantage&#039; https:\/\/jigsaw.vitalsource.com\/login\n<\/code><\/pre><br \/>\n &#8222;print&#8220; the whole page and look for the page with &#8222;print&#8220; in it:<br \/>\n<pre><code class=\"preserve-code-formatting\">https:\/\/jigsaw.vitalsource.com\/api\/v0\/books\/somebook\/print?from=chapter-1&amp;amp;to=chapter-end\n<\/code><\/pre><br \/>\nThis will give you a html with all picture links in it. I saved it as links.txt<br \/>\n<pre><code class=\"preserve-code-formatting\">LINKS=$(sed -re &#039;\/src\/!d&#039; -e &#039;\/.js\/d&#039; -e &#039;\/.css\/d&#039; -e &#039;s#.*src=&quot;(.*?)&quot;.*#https:\/\/jigsaw.vitalsource.com\/\\1#&#039; -e &#039;s#800#2048#&#039; -e &#039;s#%20# #&#039; links.txt)\ncounter=1\nfor i in $(echo $LINKS); do\nwget --load-cookies cookies.txt ${i} -O &quot;$(printf &quot;%03d&quot; ${counter}).jpg&quot;\n((counter+=1))\ndone<\/code><\/pre><\/p>\n<p>If printing isn&#8217;t available, it is possible to iterate through the pages and get the image source out of the html. Open the first page and look at the frame source code for something like &#8222;https:\/\/jigsaw.vitalsource.com\/books\/HK758SH-00-DATASH-E\/pages\/348102883\/content&#8220;. The number 348102883 can be iterated.<br \/>\nYou get the image source link with:<\/p>\n<p><pre><code class=\"preserve-code-formatting\">\nwget --header=&quot;Accept-Encoding: compress, gzip&quot; --header=&quot;Accept: text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,*\/*;q=0.8&quot; --user-agent=&#039;Mozilla\/5.0 (X11; Linux i686) AppleWebKit\/537.36 (KHTML, like Gecko) Ubuntu Chromium\/53.0.2785.143 Chrome\/53.0.2785.143 Safari\/537.36&#039; --ignore-length --keep-session-cookies --save-cookies cookies.txt --load-cookies cookies.txt &#039;https:\/\/jigsaw.vitalsource.com\/books\/HK758SH-00-DATASH-E\/pages\/348102883\/content&#039; -O - | gunzip | sed -re &#039;\/src\/!d&#039; -e &#039;\/.js\/d&#039; -e &#039;s#.*src=&quot;(.*?)&quot;.*&quot;.*?&quot;.*#https:\/\/jigsaw.vitalsource.com\/\\1#&#039; -e &#039;s#800#2000#&#039; -e &#039;s#%20# #&#039;\n<\/code><\/pre><\/p>\n<p>If there are some numbers missing there is a 302 status code. Run in a loop and first check with<\/p>\n<p><pre><code class=\"preserve-code-formatting\">wget --keep-session-cookies --save-cookies cookies.txt --load-cookies cookies.txt -S &quot;https:\/\/jigsaw.vitalsource.com\/books\/HK758SH-00-DATASH-E\/pages\/348102884\/content?create=true&quot; 2&amp;gt;&amp;amp;1 | grep &quot;HTTP\/&quot; | awk &#039;{print $2}&#039; | head -n1\n<\/code><\/pre><\/p>\n<p>if it is 200 or 302. If 200 you can get the correct image source link.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>login and save session cookie: wget &#8211;keep-session-cookies &#8211;user-agent=Mozilla\/5.0 &#8211;save-cookies cookies.txt &#8211;post-data &#039;user%5Bemail%5D=someone%40someplace.com&amp;amp;user%5Bpassword%5D=asdf&amp;amp;return=https%3A%2F%2Fevantage.gilmoreglobal.com%2F%23%2F&amp;amp;failure=https%3A%2F%2Fevantage.gilmoreglobal.com%2F%23%2Fuser%2Fsignin%2Ffailure%2Fsomeone%2540someplace.com&amp;amp;jigsaw_brand=evantage&#039; https:\/\/jigsaw.vitalsource.com\/login &#8222;print&#8220; the whole page and look for the page with &#8222;print&#8220; in it: https:\/\/jigsaw.vitalsource.com\/api\/v0\/books\/somebook\/print?from=chapter-1&amp;amp;to=chapter-end This will give you a html with all picture links in it. I saved it as links.txt LINKS=$(sed -re &#039;\/src\/!d&#039; -e &#039;\/.js\/d&#039; -e &#039;\/.css\/d&#039; -e &#039;s#.*src=&quot;(.*?)&quot;.*#https:\/\/jigsaw.vitalsource.com\/\\1#&#039; -e &#039;s#800#2048#&#039; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[104,274,275,273],"class_list":["post-562","post","type-post","status-publish","format-standard","hentry","category-it","tag-download","tag-ebook","tag-vitalsource-com","tag-wget"],"_links":{"self":[{"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/posts\/562","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/comments?post=562"}],"version-history":[{"count":13,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/posts\/562\/revisions"}],"predecessor-version":[{"id":570,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/posts\/562\/revisions\/570"}],"wp:attachment":[{"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/media?parent=562"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/categories?post=562"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/tags?post=562"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}