Fix sharedfiles scraping error when Steam returns non-English page, fix rejected request detection and improve type detection
Hey! I've gotten multiple bug reports that scraping the Posted date of a sharedfile can cause an error as Steam can apparently serve a non-English page as response to our request.
I didn't consider this to be a possibility and didn't encounter this issue while testing, even though my accounts are also not English but German.
I have added a &l=english query parameter to the request and added a fallback to the Posted readout, so that even if it should fail again, no error will be thrown and the Posted value remains null.
This fix has been tested and the users who reported it confirmed that the issue did not reoccur afterwards.
This PR now also improves type detection because I don't want to get on your nerves with another PR.
Some Artworks can have only one breadcrumb (for some reason) so this change looks at the first breadcrumb as a backup if the second one is missing. I have also added an if check to hopefully suppress further errors and instead just leave type at null.
You prob want to merge it into https://github.com/DoctorMcKay/node-steamcommunity/pull/230
This PR improves an existing feature in version 3.x.x, so I chose master
DoctorMcKay merged my previous PRs into v4 as well, so I think this shouldn't be a problem(?)
Oh okay, I didn't know you were aware that v4 was being worked on
Yeah, targeting master is appropriate for fixes to an existing feature, until v4 is out. I'm sorry about sorta ghosting this, been pretty busy for the past while. I'll try to deal with some open stuff, including this, later today.
Hey, sorry for bumping, but it would be cool if you could review this PR as it fixes bugs present in the master branch.
(There are also two more of my PRs still open, but they add new features and merge into v4 instead)