python - Web scraping from js website -
i want scrape form data https://www.investing.com/commodities/gold-historical-data, form generate js. tried imacros see action , got this:
tag pos=1 type=div attr=id:widgetfielddaterange tag pos=1 type=a attr=txt:20 tag pos=2 type=a attr=txt:13 tag pos=1 type=a attr=id:applybtn
can tell me how change python code can use in selenium?
it seems need post request (ajax).
how did find that?
well, inspected xhr network section
the post data need (replace dates want):
curr_id=8830 smlid=300004 st_date=08/09/2017 end_date=08/21/2017 interval_sec=daily sort_col=date sort_ord=desc action=historical_data
the ids aobe post data, market only(gold-historical-data), others inspect network again , see post data everytime.
how implement in python?
you need module called requests
.
specifically, read this
Comments
Post a Comment