简体   繁体   中英

Scraping with Python from XHR

I'm a new python, trying to scrape a lottery website, and create a file with the info (lottery numbers and draw numbers this is the link https://www.polla.cl/es/view/resultados

I try with

import requests
from bs4 import BeautifulSoup as soup
url = 'https://www.polla.cl/es/js/1528962859_1cfc1a8930bb080d6ccd5393c1bb2f6d.js'
r = requests.get(url)

print(r.text)

I tried with https://www.polla.cl/es/view/resultados

but I get a html as result and the info is hidden at

Can you give a help to get that numbers?

any help is apreciated

bs4 is designed for HTML/XML so it won't give you the disired result if you hand it JavaScript. This helped me getting to know webscrapping: https://automatetheboringstuff.com/chapter11/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM