Python Forum
how to make my product description fetching function generic?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to make my product description fetching function generic?
#9
(Jun-29-2018, 11:14 AM)gontajones Wrote: Try this:

def get_product_details(url):

    try:
        soup = get_soup(url)
        desc_list = soup.select('input ~ ul')
        prod_details = {}
        prod_details['description'] = ''.join([str(i) for i in desc_list])
        print(prod_details)
        return prod_details
    except Exception as ex:
        logger.warning('%s - %s', ex, url)

More robust

desc_list = soup.select('#itemPrice1 ~ ul')

It's strange with this one also I am getting blank description-
Output:
product1 description: product2 description: Process finished with exit code 0
Reply


Messages In This Thread
RE: how to make my product description fetching function generic? - by PrateekG - Jun-29-2018, 12:32 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Fetching Images from DB in Django Dexty 2 1,734 Mar-15-2024, 08:43 AM
Last Post: firn100
  All product links to products on a website MarionStorm 0 1,095 Jun-02-2022, 11:17 PM
Last Post: MarionStorm
  fetching, parsing data from Wikipedia apollo 2 3,565 May-06-2021, 08:08 PM
Last Post: snippsat
  Fetching and Parsing XML Data FalseFact 3 3,285 Apr-01-2019, 10:21 AM
Last Post: Larz60+
  My Django 2.0.6 logging is not working while product merging PrateekG 0 2,174 Jul-26-2018, 02:24 PM
Last Post: PrateekG
  Need help to get product details using BeautifulSoup+Python3.6! PrateekG 2 2,889 Jun-27-2018, 08:52 AM
Last Post: PrateekG
  Getting 'list index out of range' while fetching product details using BeautifulSoup? PrateekG 8 8,189 Jun-06-2018, 12:15 PM
Last Post: snippsat
  Unable to fetch product url using BeautifulSoup with Python3.6 PrateekG 6 4,251 Jun-05-2018, 05:49 PM
Last Post: PrateekG
  Generic If Popup Exists Close It Script digitalmatic7 1 2,491 Feb-18-2018, 07:24 AM
Last Post: metulburr

Forum Jump:

User Panel Messages

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