2

I want to get this number (dollar price) auto buy price.

def get_auto_buy_price(self):
        id = 35650 # specital number for items
        url = f"https://buff.163.com/goods/{id}?from=market#tab=buying"
        html = requests.get(url)
        soup = BeautifulSoup(html.text, "lxml")
        print(soup.find_all("div", "detail-tab-cont"))

With this code I can get where buff163 contains tables with prices but it's empty.

user11225404
  • 107
  • 1
  • 6

1 Answers1

1

Because the webpage is dynamic and data is populating from external source via API. Only requests module can grab data from API url.

import requests
res= requests.get('https://buff.163.com/api/market/goods/buy_order?game=csgo&goods_id=35650&page_num=1&_=1657808768032').json()

for price in res['data']['items']:
    print(price['price'])

Output:

1.2
1.1
1
1
1
0.8
0.1

API_SCREENSHOT

Md. Fazlul Hoque
  • 15,806
  • 5
  • 12
  • 32