Sleepmode Sleepmode - 5 months ago 9
HTML Question

How do i parse this URL with beautiful Soup? What format is the URL?

I want to crawl some data from this type of url:


http://steamcommunity.com/market/listings/730/AK-47%20%7C%20Redline%20%28Field-Tested%29/render?start=0&count=5&currency=&language=english


I don't know, it contains some kind of html-tags but i don't know how to actually scrape this page (i used beautifulSoup for my other urls).

Hope you can help me out.

Answer

The page you loaded is a JSON file. Use the JSON library like so:

import requests
import json

html = requests.get('http://steamcommunity.com/market/listings/730/AK-47%20%7C%20Redline%20%28Field-Tested%29/render?start=0&count=5&currency=&language=english')

# Load the parsed page into a JSON object.
steam_json = json.loads(html.text)

# Extract whatever you want like this:
success_status = steam_json['success']
Comments