Fetching book covers with the Google Books API

Developer
Size
8,769 Kb
Views
22,264

How do I make an fetching book covers with the google books api?

Use a book's ISBN to lookup the Google Books API and load the cover and description in a modal with links to the library catalogue.. What is a fetching book covers with the google books api? How do you make a fetching book covers with the google books api? This script and codes were developed by Martin Boyce on 20 September 2022, Tuesday.

Fetching book covers with the Google Books API Previews

Fetching book covers with the Google Books API - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Fetching book covers with the Google Books API</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel='stylesheet prefetch' href='http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="container-fluid"> <h1>List of Books</h1> <p class="lead">Use a book's ISBN to lookup the Google Books API and load the cover and description in a modal with links to the library catalogue.</p> <div id="bookDetails" class="modal fade"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title"></h4></div> <div class="modal-body"> </div> <div class="modal-footer"> <a class="btn btn-default" target="_blank">Preview</a> <a class="btn btn-success" target="_blank"></a> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog -->
</div><!-- /.modal --> <div id="newItems" class="new-items"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"> <a data-isbn="9337369007175" data-url="https://encore.sutherlandshire.nsw.gov.au/iii/encore/record/C__Rb1249267">The last gladiators.</a> </h3> </div> <div class="panel-body">"In ice hockey, no one is more feared than the enforcer. These players have only one reason to be on the ice - to protect their guys no matter what the cost to themselves or others. For Chris Nilan, once the most tenacious enforcer in the National Hockey League, the cost meant a shattered body, addiction to drugs and harming the people closest to him. But in the process this tough guy from Boston earned everlasting glory... a unique and personal insight into the warriors whose actions on the ice make Ice Hockey one of the toughest sports in the world!"--Container.</div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"> <a data-isbn="9781459696037" data-url="https://encore.sutherlandshire.nsw.gov.au/iii/encore/record/C__Rb1248596">Dangerous games : Australia at the 1936 Nazi Olympics / Larry Writer.</a> </h3> </div> <div class="panel-body">This is a tale of innocents abroad. Thirty - three athletes left Australia in May 1936 to compete in the Hitler Olympics in Berlin. Believing sporting competition was the best antidote to tyranny, they put their qualms on hold. Anything to be part of the greatest show on earth. Dangerous Games drops us into a front row seat at the 100,000 - capacity Olympic stadium to witness some of the finest sporting performances of all time - most famously the African American runner Jesse Owens, who eclipsed the best athletes the Nazis could pit against him in every event he entered. The Australians, with their antiquated training regimes and amateur ethos, valiantly confronted the intensely focused athletes of Germany, the United States and Japan. Behind the scenes was cut - throat wheeling and dealing, defiance of Hitler, and warm friendships among athletes. What they did and saw in Berlin that hot, rainy summer influenced all that came after until their dying days.</div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"> <a data-isbn="9781863957595" data-url="https://encore.sutherlandshire.nsw.gov.au/iii/encore/record/C__Rb1247967">A-league : the inside story of the tumultuous first decade / John Stensholt &amp; Shaun Mooney.</a> </h3> </div> <div class="panel-body">In December 2003, shopping centre billionaire Frank Lowy walked into a packed media conference and announced the creation of a new professional football league. Armed with $15 million of government funds, Lowy wanted to wake the sleeping giant of Australian sport, and the A-League kicked off in 2005.</div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"> <a data-isbn="9781925240375" data-url="https://encore.sutherlandshire.nsw.gov.au/iii/encore/record/C__Rb1247966">Something for the pain : a memoir of the turf / Gerald Murnane.</a> </h3> </div> <div class="panel-body">I never met anyone whose interest in racing matched my own. Both on and off the course, so to speak, I've enjoyed the company of many a racing acquaintance...I've read books, or parts of books, by persons who might have come close to being true racing friends of mine if ever we had met.</div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"> <a data-isbn="9781742576855" data-url="https://encore.sutherlandshire.nsw.gov.au/iii/encore/record/C__Rb1247913">The house that Jack built : Jack Gibson's champion Roosters team of 1974-75 / David Rowlands.</a> </h3> </div> <div class="panel-body">The Eastern Suburbs' rugby league team of the mid-1970s is widely regarded as the greatest team of the postwar, limited tackle era. Although they won only two premierships - the 1974 and 1975 seasons - it was more the way the team won that changed the game forever. Of course, the shadow of supercoach Jack Gibson looms large in this book. Gibson revolutionized rugby league when he integrated training methods from American grid iron to put his team of great players on another fitness level. Gibson, who passed away in 2008, is brought to life through the memories of the great players who played for those teams - Ron Coote, John Peard, Bunny Reilly, Johnny Mayes and Russell Fairfax to name but a few. In the same way, Arthur Beetson (1945-2011) also takes pride of place in those great teams.</div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"> <a data-isbn="1782815457" data-url="https://encore.sutherlandshire.nsw.gov.au/iii/encore/record/C__Rb1247509">Little book of the Rugby World Cup : the greatest show on Earth / [written by Paul Morgan and Liam McCann ; foreword by Ian Robertson].</a> </h3> </div> <div class="panel-body">The Rugby World Cup takes place in the UK in fall 2015 where the greatest rugby nations will gather to compete for the Webb Ellis trophy, currently held by New Zealand. This book looks at the history of the World Cup since its inception in 1987 with reviews of all of the tournaments, special features on the great matches and players that have appeared in 7 tournaments held to date. Illustrated throughout with colour photographs this is the perfect introduction to the Rugby World Cup and is a must for all rugby fans.</div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"> <a data-isbn="9780751561890" data-url="https://encore.sutherlandshire.nsw.gov.au/iii/encore/record/C__Rb1246651">Left for dead : my journey home from Everest / Beck Weathers ; with Stephen G. Michaud.</a> </h3> </div> <div class="panel-body">Anyone who has read Jon Krakauer's famous account of the 1996 Everest disaster, Into thin air, will remember the story of Beck Weathers: the gregarious Texan climber who went snow-blind in the Death Zone below the summit and who spent a night out in the open during a blizzard that took the lives of a dozen colleagues and friends. Even as he staggered back into Camp 4 the next morning, Beck's condition was such that the other survivors assumed he would not make it back down the mountain. He was effectively left for dead, but drawing upon reserves of determination and courage he didn't know he had - as well as the extraordinary selflessness and bravery of a Nepalese helicopter pilot he'd never met - he finally made it to safety. Only then could a new battle begin: to rebuild his life with a family he'd taken for granted for too long.</div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"> <a data-isbn="9781848094499" data-url="https://encore.sutherlandshire.nsw.gov.au/iii/encore/record/C__Rb1246514">One man's Everest / Kenton Cool.</a> </h3> </div> <div class="panel-body">Kenton Cool is the finest alpine climber of this generation. His accomplishments are staggering. He has summited Everest eleven times. He is the first person in history to climb the three Everest peaks, the so-called Triple Crown, in one climb, a feat previously thought impossible. He was nominated for the prestigious piolet d'Or in 2004 for climbing a previously unclimbed route on Annapurna III. In 2012 he fulfilled the Olympic Games pledge of placing a 1924 gold medal on the Everest summit. He is the only Briton to have skied down two 8000-metre mountains, and in 2009 he guided Sir Ranulph Fiennes to the summit of Everest, helping to raise over GBP3 million for Marie Curie Cancer Care. His accomplishments are all the more extraordinary considering an incident in the summer of 1996 which tore Kenton's world apart. Whilst climbing in Wales, he broke a handhold on a route aptly called 'Major Headstress' and fell to the ground with such force that he shattered both his heel bones. Initially told he would never walk unaided again, Kenton spent four weeks in hospital, had three operations, three and a half months in a wheelchair and months of rehab. Today he is still in pain and after a long day in the mountains it's not uncommon to see him struggling to walk or moving around on his hands and knees. Yet he still climbs. 'Why do you do it?' people ask him. This book tells why.</div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"> <a data-isbn="9781408706091" data-url="https://encore.sutherlandshire.nsw.gov.au/iii/encore/record/C__Rb1246379">Amazing Grace : the man who was W.G. / Richard Tomlinson.</a> </h3> </div> <div class="panel-body">William Gilbert Grace (1848-1915) looms as large in the history of modern sport as Bach in the history of music or Michelangelo in the history of art. Physically immense, with a luxuriant black mane of a beard, Grace's performances on the cricket field towered above his peers. When 'W.G.' became the first-ever batsman to score 100 first-class centuries, his nearest rival had only scored forty-three. With his rustic accent and village school education, Grace was also the victim of immense snobbery, during his lifetime and ever since. In this definitive biography, marking the centenary of W.G.'s death, Richard Tomlinson mines a trove of previously undiscovered archive material in England, Australia and North America and at last connects Grace's astounding achievements on the field (he took 3000 wickets as well) with the private life he hid from the world. Agnes, W.G.'s beloved wife, steps from the shadows of her ruined family background as the woman who rescued Grace from his own worst nature and shared his torment at the loss of their only daughter Bessie. We meet as well the swarm of chancers who preyed on Grace, from the doomed gold speculator who first brought him to Melbourne to the sex-crazed cricket grandee who captured W.G. for England's sporting aristocracy. And we join W.G. on his rounds as a lowly parish surgeon in the slums of Bristol. His patients - the paupers and tramps along the Stapleton Road - hailed their doctor each summer as he set forth from his surgery to vanquish his cricketing enemies. Through it all, W.G. emerges as one of the last Victorian inventors, transforming the game he loved and showing the modern world how to play all sport - to the death, mercilessly, with beers all round in the funeral parlour. A century after W.G. was buried with his secrets in a forlorn suburban graveyard, Amazing Grace gloriously unveils one of sport's greatest untold stories.</div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"> <a data-isbn="9781471150463" data-url="https://encore.sutherlandshire.nsw.gov.au/iii/encore/record/C__Rb1246281">Last in the tin bath : the autobiography / David Lloyd with Richard Gibson.</a> </h3> </div> <div class="panel-body">With his infectious enthusiasm for the game, David 'Bumble' Lloyd is one of the most popular cricket commentators around, blending immense knowledge and experience with an eye for the quirky detail and an unending fund of brilliant stories. This new autobiography recalls his childhood in Accrington, Lancashire, when, after a long day playing cricket in the street, he would get his chance to wash himself in his family's tin bath - but only after his parents and uncle had taken their turn first. From there he moved on to make his debut for Lancashire while still in his teens, eventually earning an England call-up, when he had to face the pace of Lillee and Thomson - with painful and eye-watering consequences. After retiring as a player, he became an umpire and then England coach during the 1990s, before eventually turning to commentary with Sky Sports. Packed with hilarious anecdotes from the golden age of Lancashire cricket, and behind-the-scenes insight into life with England and on the Sky commentary team, Bumble's book is a joy to read from start to finish.</div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"> <a data-isbn="9781445141336" data-url="https://encore.sutherlandshire.nsw.gov.au/iii/encore/record/C__Rb1245526">Tennis / Clive Gifford</a> </h3> </div> <div class="panel-body">Looking to take up a new sport? Or just thinking about ways to keep fit and healthy? This book is a great introduction to all the important tennis skills you'll need. Full of skills tips and photos showing key techniques, you'll discover everything - from training to competing - while also finding out something about tennis stars of the past and present.</div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"> <a data-isbn="9781445141008" data-url="https://encore.sutherlandshire.nsw.gov.au/iii/encore/record/C__Rb1245509">Cricket / Chris Oxlade.</a> </h3> </div> <div class="panel-body">This book is a great introduction to all the important cricket skills you'll need. Full of skills tips and photos showing key techniques, you'll discover everything - from training to competing - while also finding out something about cricket stars of the past and present.</div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"> <a data-isbn="9781445140933" data-url="https://encore.sutherlandshire.nsw.gov.au/iii/encore/record/C__Rb1245488">Football / Clive Gifford.</a> </h3> </div> <div class="panel-body">Looking to take up a new sport? Or just thinking about ways to keep fit and healthy? This book is a great introduction to all the important football skills you'll need. Full of skills tips and photos showing key techniques, you'll discover everything - from training to competing - while also finding out something about football stars of the past and present.</div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"> <a data-isbn="9781445141329" data-url="https://encore.sutherlandshire.nsw.gov.au/iii/encore/record/C__Rb1245464">Rugby / Clive Gifford.</a> </h3> </div> <div class="panel-body">Whether you are taking part or just watching, rugby is an exciting and dramatic sport. Discover everything you need to know about it from training to playing. Brilliant step-by-step photography will help you perfect your technique, while profiles and stats tell you more about the world's greatest players.</div> </div>
</div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Fetching book covers with the Google Books API - Script Codes CSS Codes

.modal-body { display: -webkit-box; display: -ms-flexbox; display: flex;
}
.modal-body p { -webkit-box-flex: 1; -ms-flex: 1 1 auto; flex: 1 1 auto; padding-left: 1.25em;
}

Fetching book covers with the Google Books API - Script Codes JS Codes

$('.panel-title a').on('click', function () { var $isbn = $(this).data('isbn'); var $catalog = $(this).data('url'); var $title = $(this).text(); var gbksTitle = $title.split('/', 1) var gbksData = 'https://www.googleapis.com/books/v1/volumes?q=isbn:' + $isbn; console.log('prepare title for gbks lookup: ' + gbksTitle); $.getJSON(gbksData, function() { console.log('Google Books JSON request successful'); }) .done(function(data) { if (data.totalItems > 0) { console.log(data); // append cover img and description to modal and show var imgCheck = data.items[0].volumeInfo.imageLinks; var descCheck = data.items[0].volumeInfo.description; var snippetCheck = data.items[0].searchInfo; var gbksLink = data.items[0].accessInfo.webReaderLink; var imgSrc, gbksDescription; // check for a cover image and define the img src in a variable if (imgCheck !== undefined) { imgSrc = data.items[0].volumeInfo.imageLinks.thumbnail; } else { imgSrc = 'http://placehold.it/128x198'; } // check for a description or summary and define a variable to hold the description if (descCheck !== undefined) { gbksDescription = descCheck; } else if (snippetCheck !== undefined) { gbksDescription = snippetCheck.textSnippet; } else { gbksDescription = 'Well spin me frisbee; there\'s no more info for you'; } // append the book data to the modal that is stubbed out in the html $('.modal-header h4').text($title); $('.modal-body').empty(); $('<div><img id="coverImage" alt="cover image" /></div><div><p id="isbn"></p><p id="summary"></p></div>').appendTo('.modal-body'); $('#coverImage').attr('src', imgSrc); $('#isbn').text('ISBN: ' + $isbn); $('#summary').text(gbksDescription); $('.modal-footer .btn-success').text('Request it!').attr('href', $catalog); $('.modal-footer .btn-default').removeAttr('disabled').attr('href', gbksLink); $('#bookDetails').modal(); } else { console.log("Sorry, no information found for that book"); // generate a link to the catalogue record var message = "Bad news friend. It looks like we could not get any extra information about that title. Best go straight to the Library Catalogue for more."; $('.modal-header h4').text($title); $('.modal-body').empty(); $('.modal-body').html('<p id="message">' + message + '</p>'); $('.modal-footer .btn-success').text('View Catalogue').attr('href', $catalog); $('.modal-footer .btn-default').attr('disabled', 'disabled'); $('#bookDetails').modal(); } });
});
Fetching book covers with the Google Books API - Script Codes
Fetching book covers with the Google Books API - Script Codes
Home Page Home
Developer Martin Boyce
Username boycetrus
Uploaded September 20, 2022
Rating 3
Size 8,769 Kb
Views 22,264
Do you need developer help for Fetching book covers with the Google Books API?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Martin Boyce (boycetrus) Script Codes
Create amazing love letters with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!