[Tutor] Beautiful Soup

Crusier crusier at gmail.com
Sun Dec 13 02:44:33 EST 2015


Dear All,

I am trying to scrap the following website, however, I have
encountered some problems. As you can see, I am not really familiar
with regex and I hope you can give me some pointers to how to solve
this problem.

I hope I can download all the transaction data into the database.
However, I need to retrieve it first. The data which I hope to
retrieve it is as follows:

"
15:59:59     A     500     6.790     3,395
15:59:53     B     500     6.780     3,390................

Thank you

Below is my quote:

from bs4 import BeautifulSoup
import requests
import re

url = 'https://bochk.etnet.com.hk/content/bochkweb/eng/quote_transaction_daily_history.php?code=6881&time=F&timeFrom=090000&timeTo=160000&turnover=S&sessionId=44c99b61679e019666f0570db51ad932&volMin=0&turnoverMin=0'

def turnover_detail(url):
    response = requests.get(url)
    html = response.content
    soup = BeautifulSoup(html,"html.parser")
    data = soup.find_all("script")
    for json in data:
        print(json)

turnover_detail(url)

Best Regards,
Henry


More information about the Tutor mailing list