crawlfetch

Spring Boot: download YouTube, TikTok and Instagram videos

Spring Boot 3.2's RestClient lets you define a CrawlFetch client bean once and inject it anywhere.

How it fits together

A configuration class builds a RestClient with the base URL and bearer header; a controller exposes a resolve endpoint to your frontend.

Spring Boot example

@Configuration
class CrawlFetchConfig {
@Bean
RestClient crawlFetch(@Value("${CRAWLFETCH_KEY}") String key) {
return RestClient.builder()
.baseUrl("https://api.crawlfetch.com")
.defaultHeader(HttpHeaders.AUTHORIZATION, "Bearer " + key)
.build();
}
}
@RestController
class ResolveController {
private final RestClient crawlFetch;
ResolveController(RestClient crawlFetch) { this.crawlFetch = crawlFetch; }
@GetMapping("/resolve")
Map<?, ?> resolve(@RequestParam String url) {
return crawlFetch.get()
.uri(b -> b.path("/v1/resolve").queryParam("url", url).build())
.retrieve()
.body(Map.class);
}
}

Notes for Spring Boot

  • Map RestClientResponseException to your error responses with @ControllerAdvice.
  • Add Spring Retry's @Retryable for 500s.

FAQ

Can I use WebClient?

Yes, for reactive stacks. The request is the same.

Related

Last updated 2026-10-25

Add video downloads to your product today.

1,000 credits on signup plus 500 every month. That is roughly 180 YouTube clips to start, with no card.

Create free account