Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Scrape java script web site
#1
Hi,
I just want scrap java script web site.
url : https://www.mcxindia.com/market-data/bhavcopy
Can anyone help me on this.

Thanks in advance
Quote
#2
what have you tried so far?
please show code
Quote
#3
Hello PythonHunger,
Can you provide the code so that we can get a clarity and maybe a chance to help you?
buran wrote Oct-24-2018, 08:39 AM:
Spam removed
Quote
#4
Hi,
Thanks for the reply.
I just want to download csv/excel file from url https://www.mcxindia.com/market-data/bhavcopy .
İmage

I have write a code but got error and browser not getting close.

from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
path_to_chromedriver = 'D:\ChromeDriver\chromedriver.exe'
browser = webdriver.Chrome(executable_path=path_to_chromedriver, options=chrome_options)
url = 'https://www.mcxindia.com/market-data/bhavcopy'
browser.get(url)
f = open(browser.find_element_by_id('cph_InnerContainerRight_C001_lnkExpToCSV').click(), 'wb')
browser.quit()
getting error :
Error:
TypeError: expected str, bytes or os.PathLike object, not NoneType
buran wrote Oct-24-2018, 09:13 AM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.

Please, post the entire traceback that you get. We need to see the whole thing. Do not just give us the last line.
Take a time to read What to include in a post
Quote
#5
The error you show doesn't look like the complete error traceback. Please post verbatim as it contains valuable information.
Quote:I just want to download csv/excel file from url url:https://www.mcxindia.com/market-data/bhavcopy .
you don't need selenium for this, you can get it with a simple requests statement:
import requests

excelfile = resquests.get(url)
Also, I tried to connect to that server and timed out.
Quote
#6
First of all find_element_by_id returns None. And you cannot set the filename to None. Second of all...

you dont have to use open() at all. You only have to click the button and it should download. However you might want to wait a few seconds after the click to allow it to download.

        browser.find_element_by_id('cph_InnerContainerRight_C001_lnkExpToCSV').click()
        time.sleep(10)
Just tested with this ant it works fine.
Quote
#7
Hi metulburr.
Its working fine now.
Thank you very much for the reply Smile .
Thanks you sir Smile
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Flask: Making my first web site Truman 18 731 Jul-05-2019, 12:08 AM
Last Post: Truman
  webscrapping links and then enter those links to scrape data kirito85 2 175 Jun-13-2019, 02:23 AM
Last Post: kirito85
  How to retrieve data from site ROHK 2 244 Mar-01-2019, 12:26 PM
Last Post: ROHK
  Scrape ASPX data with python... hoff1022 0 551 Feb-26-2019, 06:16 PM
Last Post: hoff1022
  Login to web site halo981 3 538 Jan-02-2019, 01:40 PM
Last Post: snippsat
  Captcha from other site GoTo95 1 477 Nov-13-2018, 03:48 PM
Last Post: j.crater
  Need To Scrape Some Links digitalmatic7 2 425 Oct-09-2018, 02:33 AM
Last Post: digitalmatic7
  Web App That Request Data from Another Web Site every 12-hours jomonetta 15 1,433 Sep-26-2018, 04:19 PM
Last Post: snippsat
  Basic Syntax/HTML Scrape Questions sungar78 5 664 Sep-06-2018, 09:32 PM
Last Post: sungar78
  convert html to pdf in django site shahpy 4 2,585 Aug-17-2018, 11:10 AM
Last Post: Larz60+

Forum Jump:


Users browsing this thread: 1 Guest(s)