mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-31 02:17:01 -04:00 
			
		
		
		
	Changes AudiobookCovers.com provider to return the full size png file from the server. The original file url has the incorrect content-type header set, which caused issues downloading new cover images.
		
			
				
	
	
		
			24 lines
		
	
	
		
			611 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			611 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| const axios = require('axios')
 | |
| const Logger = require('../Logger')
 | |
| 
 | |
| class AudiobookCovers {
 | |
|   constructor() { }
 | |
| 
 | |
|   async search(search) {
 | |
|     const url = `https://api.audiobookcovers.com/cover/bytext/`
 | |
|     const params = new URLSearchParams([['q', search]])
 | |
|     const items = await axios.get(url, { params }).then((res) => {
 | |
|       if (!res || !res.data) return []
 | |
|       return res.data
 | |
|     }).catch(error => {
 | |
|       Logger.error('[AudiobookCovers] Cover search error', error)
 | |
|       return []
 | |
|     })
 | |
|     return items.map(item => ({ cover: item.versions.png.original }))
 | |
|   }
 | |
| }
 | |
| 
 | |
| 
 | |
| 
 | |
| module.exports = AudiobookCovers
 |