Python Forum
not getting image src in my BeautifulSoup csv file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
not getting image src in my BeautifulSoup csv file
#11
yes product url and iamge url are different. They are not same. You can see my full code
Reply
#12
I ask because you started to speak of multiple img links, but getting one product link in the csv file
(Sep-14-2020, 04:00 PM)farhan275 Wrote: I am getting multiple images url for every product
(Sep-14-2020, 04:00 PM)farhan275 Wrote: But in my csv still now getting only one product url from each product

In my opinion (not able to test) but your latest code
with io.open("amazon.csv", "a",encoding="utf-8") as f:
    for url in dpsoup.select('span.a-button-text > img')[3:10]:
        print(f"image link:{url['src']}")
        writeFile = csv.writer(f)
        writeFile.writerow([url['src'],product_link ,title,rating,price]) 
should write multiple img urls per product (each on different line)
The only explanation is that the code you run is actually different from the one you show here.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  BeautifulSoup Showing none while extracting image url josephandrew 0 1,905 Sep-20-2021, 11:40 AM
Last Post: josephandrew
  Image Scraper (beautifulsoup), stopped working, need to help see why woodmister 9 3,959 Jan-12-2021, 04:10 PM
Last Post: woodmister

Forum Jump:

User Panel Messages

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