package tasks.mine;

import io.Writer;
import main.Config;
import tasks.mine.queries.SearchQuery;

public class Search {

	public void run(String query) {
		Writer writer = new Writer(Config.resultFile, query);

		int page = 0;
		boolean cont = true;
		while (cont) {
			String url = "https://api.github.com/search/repositories?q=" + query
					+ "+language:java&sort=stars&order=desc&per_page=100&page=" + page;
			SearchQuery searchQuery = new SearchQuery(writer);
			cont = searchQuery.searchRepos(url);
			page++;
		}
		System.out.println("Search finished");
	}
}
