HentaiFox: Fix thumbnails on mobile UAs (#691)
This commit is contained in:
		
							parent
							
								
									34bc7e7a7a
								
							
						
					
					
						commit
						259e12ad25
					
				| @ -1,7 +1,7 @@ | |||||||
| ext { | ext { | ||||||
|     extName = 'HentaiFox' |     extName = 'HentaiFox' | ||||||
|     extClass = '.HentaiFox' |     extClass = '.HentaiFox' | ||||||
|     extVersionCode = 4 |     extVersionCode = 5 | ||||||
|     isNsfw = true |     isNsfw = true | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -46,7 +46,7 @@ class HentaiFox : ParsedHttpSource() { | |||||||
|                 title = it.text() |                 title = it.text() | ||||||
|                 setUrlWithoutDomain(it.attr("href")) |                 setUrlWithoutDomain(it.attr("href")) | ||||||
|             } |             } | ||||||
|             thumbnail_url = element.select("img").first()!!.attr("abs:src") |             thumbnail_url = element.selectFirst("img")!!.imgAttr() | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -98,7 +98,7 @@ class HentaiFox : ParsedHttpSource() { | |||||||
|                 title = info.select("h1").text() |                 title = info.select("h1").text() | ||||||
|                 genre = info.select("ul.tags a").joinToString { it.ownText() } |                 genre = info.select("ul.tags a").joinToString { it.ownText() } | ||||||
|                 artist = info.select("ul.artists a").joinToString { it.ownText() } |                 artist = info.select("ul.artists a").joinToString { it.ownText() } | ||||||
|                 thumbnail_url = info.select("img").attr("abs:src") |                 thumbnail_url = info.select("img").first()!!.imgAttr() | ||||||
|                 description = info.select("ul.parodies a") |                 description = info.select("ul.parodies a") | ||||||
|                     .let { e -> if (e.isNotEmpty()) "Parodies: ${e.joinToString { it.ownText() }}\n\n" else "" } |                     .let { e -> if (e.isNotEmpty()) "Parodies: ${e.joinToString { it.ownText() }}\n\n" else "" } | ||||||
|                 description += info.select("ul.characters a") |                 description += info.select("ul.characters a") | ||||||
| @ -137,7 +137,7 @@ class HentaiFox : ParsedHttpSource() { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     override fun imageUrlParse(document: Document): String { |     override fun imageUrlParse(document: Document): String { | ||||||
|         return document.select("img#gimg").attr("abs:data-src") |         return document.selectFirst("img#gimg")!!.imgAttr() | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     override fun pageListParse(document: Document): List<Page> = throw UnsupportedOperationException() |     override fun pageListParse(document: Document): List<Page> = throw UnsupportedOperationException() | ||||||
| @ -212,4 +212,12 @@ class HentaiFox : ParsedHttpSource() { | |||||||
|         Filter.Select<String>(displayName, vals.map { it.first }.toTypedArray()) { |         Filter.Select<String>(displayName, vals.map { it.first }.toTypedArray()) { | ||||||
|         fun toUriPart() = vals[state].second |         fun toUriPart() = vals[state].second | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     private fun Element.imgAttr() = when { | ||||||
|  |         hasAttr("data-cfsrc") -> absUrl("data-cfsrc") | ||||||
|  |         hasAttr("data-src") -> absUrl("data-src") | ||||||
|  |         hasAttr("data-lazy-src") -> absUrl("data-lazy-src") | ||||||
|  |         hasAttr("srcset") -> absUrl("srcset").substringBefore(" ") | ||||||
|  |         else -> absUrl("src") | ||||||
|  |     } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 beerpsi
						beerpsi