Answer the question
In order to leave comments, you need to log in
How can you parse sites in Golang and pull out the desired text when it is in a table?
You need to get it off the job site. Usually these are divs with classes, but in this case everything is in a table. With divs it's easier, I do something like this
res, err := http.Get(VacancyUrl)
if err != nil {
log15.Error("getting response body with error", log15.Ctx{
"url": VacancyUrl,
"err": err,
})
return
}
defer res.Body.Close()
if res.StatusCode != 200 {
log15.Error("getting bed status code error", log15.Ctx{
"url": VacancyUrl,
"err": err,
})
}
// Load the HTML document
doc, err := goquery.NewDocumentFromReader(res.Body)
if err != nil {
log15.Error("getting response body with error", log15.Ctx{
"url": VacancyUrl,
"err": err,
})
}
// Find the review items
doc.Find(".vacancy__item").Each(func(i int, s *goquery.Selection) {
VacancyName := s.Find(".vacancy__name").Text()
SeniorLevel, MainTechnology := vacancy.SetSeniorLevelAndMainTechnology(VacancyName)
City := s.Find(".vacancy__city").Text()
Technologies := " "
link := VacancyUrl
<tr>
<td style="width: 130.219px; text-align: left; vertical-align: top;">
<p><strong>Специалист контакт-центра</strong></p>
<p> </p>
<p>(Днепр, ул. Старокозацкая, 37)</p>
</td>
<td style="width: 108.219px; text-align: left; vertical-align: top;">
<p>Отдел клиентской поддержки</p>
</td>
<td style="width: 191.219px; text-align: left; vertical-align: top;" colspan="2">
<ul style="margin-top: 0px;">
<li style="margin-bottom: 5px;">Общение с клиентами – юридическими лицами в мессенджерах и по телефону.</li>
<li style="margin-bottom: 5px;">Качественная консультация клиента.</li>
<li style="margin-bottom: 5px;">Решение вопроса клиента с первого обращения</li>
</ul>
</td>
<td style="width: 204.219px; text-align: left; vertical-align: top;" colspan="2">
<ul style="margin-top: 0px;">
<li style="margin-bottom: 5px;">От 20 лет.</li>
<li style="margin-bottom: 5px;">Возможность работать в ночную смену.</li>
<li style="margin-bottom: 5px;">Опыт работы в call-center – от 1 года.</li>
</ul>
</td>
</tr>
<tr>
<td style="width: 130.219px; text-align: left; vertical-align: top;">
Answer the question
In order to leave comments, you need to log in
If you just extract the text, then
https://kananrahimov.com/post/golang-html-tokenize...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question