forebet web scraping
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

Hello

I need a web scraping work , data should be extracted using php code from

https://www.forebet.com/en/football-tips-and-predictions-for-today

For each match listed in this page the script should extract data and save them
in a predictions.txt file (one match per row), in this format

Ir1|04/02/2019|12:45|Esteghlal Khuzestan:Machine Sazi|19|56|25|1.99|13-15|2.53

where..

Ir1 match location
04/02/2019 date scraped from page
12:45 match time scraped from page
Esteghlal Khuzestan:Machine Sazi team home against team away separated by ":"
19 probablity home (1)
56 probability draw (X)
25 probability away (2)
1.99 average goals
13-15 temperature
2.53 odds

note that if there are a lot of matches, the page will show a "more +" button . Also the matches shown after pressing the "more +" button should be added in the result.

Thank you

why do you need PHP?
slang800 3 months ago
the file to extract data should be this https://www.forebet.com/scripts/getrs.php?ln=en&tp=1x2&in=1 but not sure
graz68 3 months ago
awarded to slang800
Tags
PHP
scraping

Crowdsource coding tasks.

1 Solution

Winning solution

This bash command will do it:

curl -s "https://www.forebet.com/scripts/getrs.php?ln=en&tp=1x2&in=1" \
| jq -r '.[] | [.host_stadium, .DATE_BAH, "\(.HOST_NAME):\(.GUEST_NAME)", .Pred_1, .Pred_X, .Pred_2, .goalsavg, "\(.weather_low)-\(.weather_high)", .best_odd_1] | @tsv' \
| sed 's/\t/|/g' \
> ./my-output-file.txt

And the output looks like this:

Estadio de Excursionistas|2019-02-04 22:00:00|Excursionistas BsAs:Ferrocarril Midland|29|38|33|1.92|25-26|2.7
Estadio Presbítero Bartolomé Grella|2019-02-04 23:00:00|Patronato Paraná:Atlético Tucumán|22|24|54|2.74|22-23|3.2
Estadio Doce de Octubre|2019-02-05 00:00:00|Cortuluá:Tigres FC (COL)|50|19|31|2.08|19-20|1.79
Estadio Eva Perón de Junín|2019-02-05 00:05:00|Sarmiento Junín:Instituto Córdoba|50|27|23|3.11|20-21|2.37
Estadio Ingeniero Hilario Sánchez|2019-02-05 01:15:00|San Martin S.J.:Estudiantes La Plata|37|35|27|2.22|24-25|2.73
Estadio Omnilife|2019-02-05 01:36:00|Guadalajara Chivas:TR Veracruz|59|21|19|1.78|16-16|1.44
Estadio Manuel Murillo Toro|2019-02-05 02:00:00|Deportes Tolima:Rionegro Águilas|34|43|22|2.14|25-25|1.85
GMC Stadium|2019-02-05 09:30:00|Indian Arrows:Minerva Punjab|25|29|46|1.92|null-null|
North Ipswich Reserve|2019-02-05 10:30:00|Western Pride:Brisbane Roar U21|63|8|30|5.21|22-22|1.9
Jawaharlal Nehru Stadium|2019-02-05 12:30:00|Shillong Lajong:Churchill Brothers|15|22|64|2.23|17-19|7.5
Dr. Azodi Stadium|2019-02-05 13:00:00|Sepidrood Rasht:Saipa Karaj|31|33|36|2.47|11-13|3.14
Takhti Stadium (Abadan)|2019-02-05 13:30:00|Sanat Naft AC:Sepahan Esfahan|12|46|42|2.26|20-21|0
Suez Stadium|2019-02-05 14:00:00|Petrojet Suez:Wadi Degla SC|19|38|42|1.39|null-null|0
Suez Stadium|2019-02-05 14:00:00|Petrojet Suez:Wadi Degla SC|19|41|40|1.89|24-25|2.75
Ittihad Kalba Club Stadium|2019-02-05 14:15:00|Ittihad Kalba:Wahda Abu Dhabi|28|32|40|2.89|18-19|3.4
Khalid Bin Mohammed Stadium|2019-02-05 14:20:00|Sha'ab Sharjah:Al Dhafra|54|31|15|2.93|20-20|1.33
Stade du 20 Août 1955|2019-02-05 15:00:00|CR Belouizdad:ES Sétif|26|33|41|1.41|12-12|2.37
Folād Shahr Stadium|2019-02-05 15:45:00|Zob Ahan:Nassaji Mazandaran|35|39|26|1|null-null|0
Stade de l'Unité Maghrébine|2019-02-05 17:00:00|MO Béjaïa:USM Alger|16|26|58|2.39|6-6|2.87
Stade 20 Août 1955|2019-02-05 17:00:00|CA Bordj Bou Arreridj:DRB Tadjenanet|30|38|32|3|5-5|1.8
Petrosport Stadium|2019-02-05 17:00:00|ENPPI Cairo:Ahly Cairo|14|30|56|2.45|null-null|7
Sheikh Khalifa International Stadium|2019-02-05 17:00:00|Al Ain:Emirates Club|74|15|11|3.29|17-17|1.25
July 5 Stadium|2019-02-05 18:00:00|MC Alger:O Médéa|33|48|19|2.13|8-8|1.8
Volksparkstadion|2019-02-05 18:30:00|Hamburger SV:Nürnberg|52|22|26|3.27|3-3|1.9
Voith-Arena|2019-02-05 18:30:00|Heidenheim:Bayer Leverkusen|37|17|47|0.17|-6--6|5.75
Stade Henri Seigneur|2019-02-05 18:30:00|Iris Club Croix:Dijon FCO|38|18|43|2.7|null-null|5.75
Stade Saint-Symphorien|2019-02-05 18:30:00|FC Metz:US Orléans|46|28|26|3.88|0-0|1.46
Stade de la Beaujoire - Louis Fonteneau|2019-02-05 18:30:00|FC Nantes:Toulouse FC|34|36|30|3.6|11-11|1.9
Stade Vélodrome|2019-02-05 19:00:00|Marseille:Girondins Bordeaux|39|41|19|0.97|9-9|2.35
Estadio Metropolitano de Techo|2019-02-05 20:00:00|Bogotá FC:Atlético FC|48|14|38|2.29|20-20|0
Leylands Park|2019-02-05 20:30:00|Burgess Hill:Harlow Town|23|42|34|3.27|9-9|2.49
Prenton Park|2019-02-05 20:45:00|Tranmere Rovers:Northampton|40|43|18|2.7|9-9|2.2
LCI Rail Stadium|2019-02-05 20:45:00|Cheltenham:Yeovil Town|22|35|43|2.58|9-9|2.2
Rodney Parade|2019-02-05 20:45:00|Newport County:Middlesbrough|23|42|35|2.75|10-10|4.75
Molineux Stadium|2019-02-05 20:45:00|Wolverhampton:Shrewsbury|51|33|16|2.83|9-9|1.19
Loftus Road Stadium|2019-02-05 20:45:00|QPR:Portsmouth|44|26|30|2|9-9|2.05
Griffin Park|2019-02-05 20:45:00|Brentford:Barnet|47|23|31|1.9|9-9|1.16
Bootham Crescent|2019-02-05 20:45:00|York City:Hereford Utd|24|37|38|3.7|7-7|2.37
Kingfield Stadium|2019-02-05 20:45:00|Woking:Dartford|42|28|31|2.68|9-9|1.42
Treyew Road|2019-02-05 20:45:00|Truro City:Wealdstone|25|33|42|3.05|11-11|2.75
Park View Road|2019-02-05 20:45:00|Welling Utd:Chippenham|49|24|27|3.67|9-9|1.72
Stair Park|2019-02-05 20:45:00|Stranraer FC:Stenhousemuir FC|46|24|30|4.03|null-null|2
Stangmore Park|2019-02-05 20:45:00|Dungannon Swifts:Coleraine FC|20|33|47|2.79|5-5|4.5
The Showgrounds (Newry)|2019-02-05 20:45:00|Newry City:Glentoran Belfast|26|36|37|2.56|5-5|3.8
Schauinsland-Reisen-Arena|2019-02-05 20:45:00|MSV Duisburg:Paderborn|37|16|47|2.72|0-0|3.6
Signal-Iduna-Park|2019-02-05 20:45:00|Borussia Dortmund:Werder Bremen|44|22|33|3.22|0-0|1.54
The Fullicks Stadium|2019-02-05 20:45:00|Folkestone Invicta:Corinthian-Casuals|56|22|23|3.5|8-8|1.64
Hartsdown Park|2019-02-05 20:45:00|Margate FC:Dorking Wanderers|16|25|59|2.88|7-7|3.07
The Enclosed Ground|2019-02-05 20:45:00|Whitehawk FC:Leatherhead|19|49|32|2.38|9-9|0
Woodside Road|2019-02-05 20:45:00|Worthing FC:Carshalton|35|37|28|3.21|9-9|2.05
Woodside Park|2019-02-05 20:45:00|Bishops Stortford:Enfield Town|27|23|49|2.9|9-9|2.36
Tatnam Stadium|2019-02-05 20:45:00|Poole Town:Walton Casuals|46|34|20|3.3|10-10|1.71
CRY Community Stadium|2019-02-05 20:45:00|Kings Langley:Metropolitan Police|25|29|46|1.5|9-9|2.42
The Camrose|2019-02-05 20:45:00|Basingstoke:Salisbury City|21|33|46|3.07|10-10|2.93
Estadio Beto Larrosa|2019-02-05 21:00:00|Sacachispas:All Boys|22|27|51|3.63|26-26|0
Estadio Fragata Presidente|2019-02-05 21:00:00|Almirante Brown:San Telmo|43|29|28|1.93|26-26|2.5
Estadio de Colegiales|2019-02-05 21:00:00|Colegiales:UAI Urquiza|33|47|20|1.23|26-26|0
Estadio Gildo Francisco Ghersinich|2019-02-05 21:00:00|El Porvenir:Sportivo Dock Sud|19|35|46|2.55|26-26|3.09
Stade Armand-Césari|2019-02-05 21:00:00|SC Bastia:SM Caen|34|27|38|2.46|7-7|5
Estadio Juan Antonio Arias|2019-02-05 21:00:00|Yupanqui:CA Lugano|27|31|42|2.36|28-28|2.35
Estadio Gigante de Villa Fox|2019-02-05 21:05:00|Defensores Unidos:Barracas Central|22|30|48|3.05|26-26|0
Estádio Municipal 22 de Junho|2019-02-05 21:15:00|FC Famalicão:Paços de Ferreira|45|33|22|2.63|3-3|3.1
Estadio Jorge|2019-02-05 22:00:00|Universidad CR:AD Carmelita|39|24|37|2.47|28-28|1.8