Get your own cookie
Lottery page click on the lottery, find draw request, copy all the cookies down, into the code on the line.
code
import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestTemplate; public class Lottery { private static final String URL = "https://api.juejin.cn/growth_api/v1/lottery/draw"; */ private static final String MY_COOKIES = ""; Public static void main(String[] args) {// HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); headers.add(HttpHeaders.COOKIE, MY_COOKIES); // Empty parameter {} MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>(); HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(paramMap, headers); RestTemplate restTemplate = new RestTemplate(); for (int i = 0; i < 200; i++) { ResponseEntity<String> stringResponseEntity = restTemplate.postForEntity(URL, httpEntity, String.class); / / System. Request returns results out. Println (stringResponseEntity. GetBody ()); }}}Copy the code