stanikol / olx Goto Github PK
View Code? Open in Web Editor NEWWeb crawler / web scraper micro-service for downloading advertisements from http://olx.ua
Web crawler / web scraper micro-service for downloading advertisements from http://olx.ua
Добрый день. Большое спасибо за разработку этого парсера. Сделал все по инструкции. Все запустилось на http://localhost:8080/
Однако после нажатия на кнопку Go
появляется ошибка There was an internal server error. В чем может быть проблема?
Выполняю на macbook pro 2015.
Здравствуйте, вместо номера вот
https://i.gyazo.com/c598f0dccf789683418d26d1f8aca4cf.png
И еще проблема: на 44 объявлении остановился скрипт.
Заранее спасибо, если исправите!
Hi!
In the beginning I wanted to congratulate you on a very smart code and at the same time ask for help in implementing it for the Polish site - olx.pl. The olx.ua and olx.pl code looks almost identically and the scraper handles all the data except the most important one - the telephone number. Obtains only zero in place of the phone. I'm stuck on this problem and I m asking for help. Below I paste a slightly modified GrabOlx.scala code from lines 62 to 95
siteid = Try("""(?:ID ogłoszenia\:\s*)(\d+)""".r.findFirstMatchIn(soup.select("span:matches((Dodane|Dodane z telefonu))").head.text()).get.group(1)).toOption.getOrElse("")
//
phoneToken = getPhoneToken(responseBody)
cookies = getCookies(response).map {
case HttpCookie(name, value, _, _, _, _, _, _, _) if name.equals("pt") =>
HttpCookiePair(name, phoneToken)
case x@HttpCookie(name, value, _, _, _, _, _, _, _) =>
HttpCookiePair(name, value)
}
//
data = Map(
"seq" -> counter.get().toString,
"siteid" -> siteid,
"brief" -> Try(soup.select("table:contains(Oferta od) > tbody > tr > td").map(_.text).mkString("\n")).toOption.getOrElse(""),
"head" -> soup.select(".offer-titlebox h1").headOption.map(_.text().trim).getOrElse(""),
"text" -> soup.select("#textContent").headOption.map(_.text()).getOrElse(""),
"pubdate" -> soup.select("span:matches((Dodane|Dodane z telefonu))").headOption.map(_.text()).getOrElse(""),
"url" -> uri,
"usrid" -> Try(usrid).toOption.getOrElse(""),
"user" -> Try(soup.select("a:matches((?i)(Ogłoszenia użytkownika|Ogłoszenia użytkownika))").head.attr("href")).getOrElse(""),
"price" -> soup.select("div.pricelabel strong").headOption.map(_.text()).getOrElse(""),
"location" -> soup.select(".show-map-link").headOption.map(_.text()).getOrElse(""),
"username" -> soup.select(".userdetails span").headOption.map(_.text()).getOrElse(""),
"section" -> Try(soup.select("#breadcrumbTop ul span").map(_.text()).filter(_.nonEmpty).mkString("/")).toOption.getOrElse(""),
"viewed" -> Try(soup.select("div.pdingtop10:contains(Wyświetleń:) > strong").head.text()).toOption.getOrElse(""),
"downdate" -> DateTime.now().toString("yyyy-MM-dd HHmmss")
)
} yield (data, Cookie(cookies), phoneToken, usrid)
}
}
def downloadPhones(implicit as: ActorSystem, mat: ActorMaterializer, ec: ExecutionContext) =
Flow[(Map[String, String], Cookie, String, String)].mapAsync(10){ case (data, cookie, phoneToken, usrid) =>
val phonesUri = s"https://www.olx.pl/ajax/misc/contact/phone/$usrid/?pt=${phoneToken}"
I will be very grateful for any help
Regards,
Karamucho
Добрый день!
Я развернул API локально на компьютере.
Все работает прекрасно с localhost:8080
.
Но я не могу получить доступ к API извне сети через статический IP адрес 46.**.***.**:8080
.
Использую статический IP адрес, переадресацию на роутере включил.
Я обратил внимание на отрывок кода, где запускается сервер, возможно здесь что-то нужно изменить? Я не разбираюсь в Akka HHTP.
val bindingFuture: Future [Http.ServerBinding] =
Http (). NewServerAt ("localhost", 3031) .bindFlow (route)
Не поможете мне?
P.S. спасибо за работу над проектом, парсер очень меня выручил
Здравствуйте, сейчас пытаюсь повторить Ваш успех, только на python. Подскажите как Вы обходили блокировку cloudflare ? Насколько я вижу, Ваш репозиторий живой и Вы продолжаете вносить изменения в код. У меня сложилась такая ситуация, что меня блокирует cloudflare из за большого количества запросов, видел, что вы используете прокси в своем проекте, у меня были попытки делать так-же, только через torpy (библиотека которая создает сессию с прокси Tor), но получалось, что torpy не всегда выдавал мне новый ip и сервис просто падал. Буду с нетерпением ждать ответа!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.