Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Web scraping data
#1
Hello,

I'm new in python and in web scraping, so sorry if my answer is stupid but i don't find anything to do that.

Is it possible to scrap data from a website where the data came from a javascript call.

Eg : I want to scrap the results on this page :

http://www.footlive.com/


Regards,
Reply
#2
(Jul-03-2021, 02:34 PM)Mike_Eddy Wrote: Is it possible to scrap data from a website where the data came from a javascript call.
Yes the easiest way is to use Selenium,there are many Thread about this here if search.
Can also look at Web-scraping part-2.

To give a example.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from time import sleep

#--| Setup
options = Options()
#options.add_argument("--headless")
browser = webdriver.Chrome(executable_path=r'C:\cmder\bin\chromedriver.exe', options=options)
#--| Parse or automation
url = "http://www.footlive.com/"
browser.get(url)
sleep(2)
score = browser.find_elements_by_css_selector('#game_1052957 > table > tbody > tr > td:nth-child(3)')[0]
print(score.text)
Output:
Brazil 1 : 0 Chile
likes this post
Reply
#3
(Jul-03-2021, 04:02 PM)snippsat Wrote:
(Jul-03-2021, 02:34 PM)Mike_Eddy Wrote: Is it possible to scrap data from a website where the data came from a javascript call.
Yes the easiest way is to use Selenium,there are many Thread about this here if search.
Can also look at Web-scraping part-2.

To give a example.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from time import sleep

#--| Setup
options = Options()
#options.add_argument("--headless")
browser = webdriver.Chrome(executable_path=r'C:\cmder\bin\chromedriver.exe', options=options)
#--| Parse or automation
url = "http://www.footlive.com/"
browser.get(url)
sleep(2)
score = browser.find_elements_by_css_selector('#game_1052957 > table > tbody > tr > td:nth-child(3)')[0]
print(score.text)
Output:
Brazil 1 : 0 Chile

thank you
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to scraping data from dinamic site sergio21124444 2 636 Nov-08-2023, 12:43 PM
Last Post: sergio21124444
  Scraping data from table into existing dataframe vincer58 1 1,960 Jan-09-2022, 05:15 PM
Last Post: vincer58
  Scraping lender data from Ren Ren Dai website using Python. I will pay for that 200$ Hafedh_2021 1 2,724 May-18-2021, 08:41 PM
Last Post: snippsat
  Scraping a page with log in data (security, proxies) iamaghost 0 2,103 Mar-27-2021, 02:56 PM
Last Post: iamaghost
  Scraping Data from Singapore Turf Club singaporeman 2 2,358 Dec-15-2020, 01:28 PM
Last Post: MrBitPythoner
Thumbs Up Issue facing while scraping the data from different websites in single script. Balamani 1 2,075 Oct-20-2020, 09:56 AM
Last Post: Larz60+
  POST request with form data issue web scraping hoff1022 1 2,649 Aug-14-2020, 10:25 AM
Last Post: kashcode
  Scraping Data issues TrexKikBut 1 3,861 Aug-14-2020, 10:20 AM
Last Post: kashcode
  Scraping a dynamic data-table in python through AJAX request filozofo 1 3,823 Aug-14-2020, 10:13 AM
Last Post: kashcode
  Web Scraping and data collection. LordDeanUK 6 4,532 Jun-29-2020, 06:04 PM
Last Post: HarleyQuin

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020