<commit_before>package async

import (
	"net/http"
	"time"
)

type Response struct {
	http *http.Response
	err  error
}

func Get(url string) (*http.Response, error) {
	channel := make(chan Response, 1)

	go func() {
		client := &http.Client{
			Timeout: 60 * time.Second,
		}

		response, err := client.Get(url)

		channel <- Response{response, err}
	}()

	response := <-channel

	return response.http, response.err
}<commit_msg>Support getting several urls at the same time<commit_after>package async

import (
	"net/http"
	"time"
)

type Response struct {
	http *http.Response
	err  error
}

func Get(urls ...string) <-chan *Response {
	channel := make(chan *Response, len(urls))
	client := &http.Client{
		Timeout: 60 * time.Second,
	}

	for _, url := range urls {
		go func(url string) {
			response, err := client.Get(url)

			if err != nil {
				defer response.Body.Close()
			}

			channel <- &Response{response, err}
		}(url)
	}

	return channel
}
{'fraction_non_alphanumeric': 0.1412133891213389, 'fraction_numerical': 0.005230125523012552, 'mean_word_length': 3.389908256880734, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2568874', 'n_tokens_mistral': 367, 'n_tokens_neox': 329, 'n_words': 93}