Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie help with lxml scrapping
#1
I am interested in using lxml Python 3 and just chose what I thought would be an easy to follow tutorial... I am simply trying to see if a button exists for add to cart to check inventory so I picked a common one "Amazon" and a random item to check.

From that I just wanted to confirm if it was in stock but I have struggled to get anything out of the below code and I am sure it's something obvious but banging my head at this point

page = requests.get('https://www.amazon.com/Sonos-Move-Battery-powered-Bluetooth-built/dp/B07W95RBZM/ref=gbps_img___706175cd?smid=A$
tree  = lxml.html.fromstring(page.content)
instock = tree.xpath('//span[@id="submit.add-to-cart-announce"]/text()')
print('AmazonStock:', instock)
at this point I'd be happy to simply pull some text off a div or span in it

thanks for any pointers https://omegle-online.com
Reply
#2
what is A$ set to?

I suspect you're not getting past the request.get statement.
You should check page.status_code == 200
if see if all went well, and display error if not.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem with scrapping Website giddyhead 1 1,582 Mar-08-2024, 08:20 AM
Last Post: AhanaSharma
  python web scrapping mg24 1 270 Mar-01-2024, 09:48 PM
Last Post: snippsat
  How can I ignore empty fields when scrapping never5000 0 1,354 Feb-11-2022, 09:19 AM
Last Post: never5000
  Suggestion request for scrapping html table Vkkindia 3 1,988 Dec-06-2021, 06:09 PM
Last Post: Larz60+
  web scrapping through Python Naheed 2 2,578 May-17-2021, 12:02 PM
Last Post: Naheed
  Website scrapping and download santoshrane 3 4,257 Apr-14-2021, 07:22 AM
Last Post: kashcode
  Scrapping Sport score laplacea 1 2,223 Dec-13-2020, 04:09 PM
Last Post: Larz60+
  How to export to csv the output of every iteration when scrapping with a loop efthymios 2 2,240 Nov-30-2020, 07:46 PM
Last Post: efthymios
  Web scrapping - Stopped working peterjv26 2 3,010 Sep-23-2020, 08:30 AM
Last Post: peterjv26
  Web scrapping login facebook credentials kosmas9 0 1,912 Aug-17-2020, 01:33 PM
Last Post: kosmas9

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020