I am trying to get the Market cost from this website, but I am not being able to get the price from this specific website, I read in other topics that this could happen because I am using urllib so the mod_security is blocking the user agent, is this the case here?
What can I do to return the market cost from the page?
import urllib.request
from urllib.request import urlopen
import re
htmlfile = urlopen("http://xiv-market.com/item_details.php?id=2727")
htmltext = htmlfile.read()
regex = b'<h2 class="details">Market Cost: <img src="images/gil.png" width="24px" height="23px" style="margin-bottom:-5px;" alt="Gil">(.+?)</h2>'
pattern = re.compile(regex)
price = re.findall(pattern, htmltext)
print(price)
Here is the error
Traceback (most recent call last):
File "C:/Python34/Gw2.py", line 6, in <module>
htmlfile = urlopen("http://xiv-market.com/item_details.php?id=2727")
File "C:\Python34\lib\urllib\request.py", line 153, in urlopen
return opener.open(url, data, timeout)
File "C:\Python34\lib\urllib\request.py", line 461, in open
response = meth(req, response)
File "C:\Python34\lib\urllib\request.py", line 574, in http_response
'http', request, response, code, msg, hdrs)
File "C:\Python34\lib\urllib\request.py", line 499, in error
return self._call_chain(*args)
File "C:\Python34\lib\urllib\request.py", line 433, in _call_chain
result = func(*args)
File "C:\Python34\lib\urllib\request.py", line 582, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden