<commit_before>package crawler

import (
	"io/ioutil"
	"net/http"
	"net/url"
	"time"

	"github.com/ReanGD/go-web-search/content"
	"github.com/temoto/robotstxt-go"
)

type robotTxt struct {
	Group    *robotstxt.Group
	HostName string
}

// FromHost - init by db element content.Host
func (r *robotTxt) FromHost(host *content.Host) error {
	robot, err := robotstxt.FromStatusAndBytes(host.RobotsStatusCode, host.RobotsData)
	if err != nil {
		return err
	}
	r.HostName = host.Name
	r.Group = robot.FindGroup("Googlebot")

	return nil
}

// FromHostName - init by hostName
// hostName - normalized host name
func (r *robotTxt) FromHostName(hostName string) (*content.Host, error) {
	robotsURL := NormalizeURL(&url.URL{Scheme: "http", Host: hostName, Path: "robots.txt"})
	response, err := http.Get(robotsURL)
	if err != nil {
		return nil, err
	}<commit_msg>модуль с robots.txt не нуждается больше в хранении имени хоста<commit_after>package crawler

import (
	"io/ioutil"
	"net/http"
	"net/url"
	"time"

	"github.com/ReanGD/go-web-search/content"
	"github.com/temoto/robotstxt-go"
)

type robotTxt struct {
	Group *robotstxt.Group
}

// FromHost - init by db element content.Host
func (r *robotTxt) FromHost(host *content.Host) error {
	robot, err := robotstxt.FromStatusAndBytes(host.RobotsStatusCode, host.RobotsData)
	if err != nil {
		return err
	}
	r.Group = robot.FindGroup("Googlebot")

	return nil
}

// FromHostName - init by hostName
// hostName - normalized host name
func (r *robotTxt) FromHostName(hostName string) (*content.Host, error) {
	robotsURL := NormalizeURL(&url.URL{Scheme: "http", Host: hostName, Path: "robots.txt"})
	response, err := http.Get(robotsURL)
	if err != nil {
		return nil, err
	}
{'fraction_non_alphanumeric': 0.13411078717201166, 'fraction_numerical': 0.0, 'mean_word_length': 4.247706422018348, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7279008', 'n_tokens_mistral': 657, 'n_tokens_neox': 650, 'n_words': 153}