Topic: Problem with making a downloading e621 images program

Posted under General

I'm trying to download images from e621. For example, uri https://static1.e621.net/data/sample/20/59/20596612061c8a81126dee5773c9ad46.jpg, it perfectly loads using browser or postman, but somehow it cannot be downloaded using programming language.

webClient.get()
    .uri("https://static1.e621.net/data/sample/20/59/20596612061c8a81126dee5773c9ad46.jpg")
    .headers { it.put("User-Agent", listOf("ex-exist art downloader")) }
    .retrieve()
    .bodyToFlux<DataBuffer>()
    .also { DataBufferUtils.write(it, Path("image.jpg"), StandardOpenOption.CREATE).block() }

Pictures from other websites can be downloaded without any issue, so I guess if I want to download a picture from e621, I have to add some header or something else. It just fails with handshake timed out, so image simply cannot be loaded. How should I properly download images?