0

Code : For Source Code of Page (product) I just want to extract price and Image Url from website. But seems Not getting anything related to image and price.

I am getting 2 different king of source code. If i do manually I get this : PasteBin and If I run through script I get this : PasteBin

import urllib2
from bs4 import BeautifulSoup

url_list = [
    "https://www.nfm.com/DetailsPage.aspx?productid=43382514"
]


def get_data(url):
    user_agent = '"Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/2.0.0.11"'
    headers = {'User-Agent': user_agent}
    page = urllib2.Request(url, None, headers)
    page2 = urllib2.urlopen(page)
    soup = BeautifulSoup(page2, 'html.parser')
    print soup.prettify()


for i in url_list:
    get_data(i)

Please can anybody explain how can I get real source code so I can get image link and some more data from website.

shiv shankar
  • 19
  • 1
  • 6

0 Answers0