Luratoon: add referer (#2799)
* add referer * move fix to base theme * add location to non zipped images
This commit is contained in:
		
							parent
							
								
									a848d1bb2e
								
							
						
					
					
						commit
						cfc2fcbf4b
					
				| @ -2,7 +2,7 @@ plugins { | |||||||
|     id("lib-multisrc") |     id("lib-multisrc") | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| baseVersionCode = 4 | baseVersionCode = 5 | ||||||
| 
 | 
 | ||||||
| dependencies { | dependencies { | ||||||
|     compileOnly("com.github.tachiyomiorg:image-decoder:e08e9be535") |     compileOnly("com.github.tachiyomiorg:image-decoder:e08e9be535") | ||||||
|  | |||||||
| @ -156,18 +156,25 @@ abstract class PeachScan( | |||||||
|     override fun pageListParse(document: Document): List<Page> { |     override fun pageListParse(document: Document): List<Page> { | ||||||
|         val scriptElement = document.selectFirst("script:containsData(const urls =[)") |         val scriptElement = document.selectFirst("script:containsData(const urls =[)") | ||||||
|             ?: return document.select("#imageContainer img").mapIndexed { i, it -> |             ?: return document.select("#imageContainer img").mapIndexed { i, it -> | ||||||
|                 Page(i, imageUrl = it.attr("abs:src")) |                 Page(i, document.location(), it.attr("abs:src")) | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|         val urls = scriptElement.html().substringAfter("const urls =[").substringBefore("];") |         val urls = scriptElement.html().substringAfter("const urls =[").substringBefore("];") | ||||||
| 
 | 
 | ||||||
|         return urls.split(",").mapIndexed { i, it -> |         return urls.split(",").mapIndexed { i, it -> | ||||||
|             Page(i, imageUrl = baseUrl + it.trim().removeSurrounding("'") + "#page") |             Page(i, document.location(), baseUrl + it.trim().removeSurrounding("'") + "#page") | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     override fun imageUrlParse(document: Document) = throw UnsupportedOperationException() |     override fun imageUrlParse(document: Document) = throw UnsupportedOperationException() | ||||||
| 
 | 
 | ||||||
|  |     override fun imageRequest(page: Page): Request { | ||||||
|  |         val imgHeaders = headersBuilder() | ||||||
|  |             .add("Referer", page.url) | ||||||
|  |             .build() | ||||||
|  |         return GET(page.imageUrl!!, imgHeaders) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     private val dataUriRegex = Regex("""base64,([0-9a-zA-Z/+=\s]+)""") |     private val dataUriRegex = Regex("""base64,([0-9a-zA-Z/+=\s]+)""") | ||||||
| 
 | 
 | ||||||
|     private fun zipImageInterceptor(chain: Interceptor.Chain): Response { |     private fun zipImageInterceptor(chain: Interceptor.Chain): Response { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Secozzi
						Secozzi