S
S
Showa2020-08-09 11:25:50
Python
Showa, 2020-08-09 11:25:50

How to make it so that when trying to parse, python does not output an empty string?

When trying to parse the initial price in steam, the python outputs an empty string

import requests
import lxml.html

def parse(url):
    api = requests.get(url)
    tree = lxml.html.document_fromstring(api.text)
    text_original = tree.xpath('//*[@id="market_commodity_forsale"]/span[2]')
    print(text_original)

parse('https://steamcommunity.com/market/listings/730/Shattered%20Web%20Case')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2020-08-09
@SoreMix

There is absolutely no content in the block with ID market_commodity_forsale.
So either ask valve to add the data you need there, or look in the requests as they appear there

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question