e.g. Audible
Send HTTP requests to audible.com/search using the file name as search query and then scrape information from the first result in the HTML response.![Screenshot](https://i.imgur.com/gYOKBTa.png)
![Screenshot](https://i.imgur.com/EId6VQs.png)
Groovy: Select all
{
def query = fn.space(' ')
def url = 'https://www.audible.com/search'.toURL(keywords: query, ipRedirectOverride: true, overrideBaseCountry: true)
def ul = html(url).select('li.authorLabel').first().parent()
def title = ul.select('h3 a').text()
def author = ul.select('li.authorLabel a').text()
def narrator = ul.select('li.narratorLabel a').text()
def series = ul.select('li.seriesLabel a').text()
def book = any{ ul.select('li.seriesLabel').text().tokenize().last() }{ null }
if (series) {
"~/Audible/$author/$series/$book - $title (narrated by $narrator)"
} else {
"~/Audible/$author/$title (narrated by $narrator)"
}
}
![Exclamation :!:](./images/smilies/icon_exclaim.gif)
Code: Select all
The Hobbit by J. R. R. Tolkien.mp3
The Hobbit.mp3