Сайт использует рендер из объекта json.Вы можете легко найти объект внутри HTML-документа.
Пример упрощенного кода:
import json
from re import search
from pprint import pprint
from requests import Session
session = Session()
session.headers['user-agent'] = (
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) '
'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/'
'66.0.3359.181 Safari/537.36'
)
limit = 5
url = 'https://warframe.market/items/ember_prime_set'
response = session.get(url=url)
res = search(
pattern='<script type="application/json" id="application-state">(.*?)</script>',
string=response.text
)
items = json.loads(res.group(1))
items = reversed(items['payload']['orders'])
for i, raw in enumerate(items):
print('#', i,'*' * 40)
print('Name', raw['user']['ingame_name'])
print('Status', raw['user']['status'])
print('platinum', raw['platinum'])
print('*' * 40)
print('RAW Document')
print('*' * 40)
pprint(raw)
print('*' * 40)
if i >= limit:
break
Результат:
# 0 ****************************************
Name afinkidayer
Status ingame
platinum 165
****************************************
RAW Document
****************************************
{'creation_date': 'iso',
'id': '5b12e102c34b9200bbea34c2',
'last_update': 'iso',
'order_type': 'sell',
'platform': 'pc',
'platinum': 165,
'quantity': 1,
'region': 'en',
'user': {'avatar': 'user/avatar/5a6b4b1f0a0674021a93262f.png?a2e235b2c1bfe9cc9a85128b5f5c1fc6',
'id': '5a6b4b1f0a0674021a93262f',
'ingame_name': 'afinkidayer',
'last_seen': '2018-06-02T18:11:33.142000+00:00',
'region': 'en',
'reputation': 3,
'reputation_bonus': 0,
'status': 'ingame'},
'visible': True}
****************************************
# 1 ****************************************
Name Guzamuza
Status ingame
platinum 160
****************************************
RAW Document
****************************************
{'creation_date': 'iso',
'id': '5b12e0ad3048b200ba93ae28',
'last_update': 'iso',
'order_type': 'sell',
'platform': 'pc',
'platinum': 160,
'quantity': 1,
'region': 'en',
'user': {'avatar': 'user/avatar/5aba587312434f04f4800b19.png?db332ade3ee5f86a7a8f417167250cfd',
'id': '5aba587312434f04f4800b19',
'ingame_name': 'Guzamuza',
'last_seen': '2018-06-02T17:50:59.343000+00:00',
'region': 'en',
'reputation': 0,
'reputation_bonus': 0,
'status': 'ingame'},
'visible': True}
****************************************
# 2 ****************************************
Name Sirfol
Status ingame
platinum 170
****************************************
RAW Document
****************************************
{'creation_date': 'iso',
'id': '5b12de9d383eea00a8bad513',
'last_update': 'iso',
'order_type': 'sell',
'platform': 'pc',
'platinum': 170,
'quantity': 1,
'region': 'en',
'user': {'avatar': None,
'id': '577a4c7a0f31390346f2a25a',
'ingame_name': 'Sirfol',
'last_seen': '2018-06-02T18:11:42.771000+00:00',
'region': 'en',
'reputation': 0,
'reputation_bonus': 0,
'status': 'ingame'},
'visible': True}
****************************************
# 3 ****************************************
Name Wanderous
Status ingame
platinum 180
****************************************
RAW Document
****************************************
{'creation_date': 'iso',
'id': '5b12dd6dffe75600b3f40393',
'last_update': 'iso',
'order_type': 'sell',
'platform': 'pc',
'platinum': 180,
'quantity': 1,
'region': 'en',
'user': {'avatar': None,
'id': '5a611023f629d700dfdbf869',
'ingame_name': 'Wanderous',
'last_seen': '2018-06-02T18:09:59.258000+00:00',
'region': 'en',
'reputation': 12,
'reputation_bonus': 0,
'status': 'ingame'},
'visible': True}
****************************************
# 4 ****************************************
Name CurryWaffle
Status ingame
platinum 185
****************************************
RAW Document
****************************************
{'creation_date': 'iso',
'id': '5b12dd27c34b9200bbea349b',
'last_update': 'iso',
'order_type': 'sell',
'platform': 'pc',
'platinum': 185,
'quantity': 1,
'region': 'en',
'user': {'avatar': 'user/avatar/5a3faf40c2c9e91d76478890.png?5ee0ca9b409cabc67edd44ebbaa60e56',
'id': '5a3faf40c2c9e91d76478890',
'ingame_name': 'CurryWaffle',
'last_seen': '2018-06-02T18:24:00.836000+00:00',
'region': 'en',
'reputation': 7,
'reputation_bonus': 0,
'status': 'ingame'},
'visible': True}
****************************************
# 5 ****************************************
Name xXfreakyXx
Status ingame
platinum 131
****************************************
RAW Document
****************************************
{'creation_date': 'iso',
'id': '5b12d9dcc34b9200a9cd3236',
'last_update': 'iso',
'order_type': 'buy',
'platform': 'pc',
'platinum': 131,
'quantity': 10,
'region': 'en',
'user': {'avatar': None,
'id': '566c5dd0b66f836b34411fd9',
'ingame_name': 'xXfreakyXx',
'last_seen': '2018-06-02T18:22:08.374000+00:00',
'region': 'en',
'reputation': 0,
'reputation_bonus': 0,
'status': 'ingame'},
'visible': True}
****************************************
Зависимости: