osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Error getting data from website


On 7/12/19 1:51 PM, Chris Angelico wrote:
> On Sat, Dec 7, 2019 at 11:46 AM Michael Torrie <torriem at gmail.com> wrote:
>>
>> On 12/6/19 5:31 PM, DL Neil via Python-list wrote:
>>> If you read the HTML data that the REPL has happily splattered all over
>>> your terminal's screen (scroll back) (NB "soup" is easier to read than
>>> is "content"!) you will observe that what you saw in your web-browser is
>>> not what Amazon served in response to the Python "requests.get()"!
>>
>> Sadly it's likely that Amazon's page is largely built from javascript.
>> So scraping static html is probably not going to get you where you want
>> to go.  There are heavier tools, such as Selenium that uses a real
>> browser to grab a page, and the result of that you can parse and search
>> perhaps.
> 
> Or look for an API instead.


Both +1
However, Selenium is possibly less-manageable for a 'beginner'.
(NB my poorly-based assumption of OP)

Amazon's HTML-response actually says this/these, but I left it open as a 
(learning) exercise for the OP. They likely prefer the API approach, 
because it can be measured...

-- 
Regards =dn