samedi 24 août 2019

Web scrapping from a list and dictionary

I have been trying to web scrap a website using python. I want to scrap data from a tag and i can't figure out how. There are two lists in there and then there seems to be a dictionary

import requests
from bs4 import BeautifulSoup

page = requests.get('https://www.daraz.pk/smartphones/nokia/?spm=a2a0e.searchlistcategory.card.2.323e5fc3B8mWd8&from'
                    '=onesearch_category_3')
# print(page.text)
soup = BeautifulSoup(page.text, 'html.parser')
# print(soup)
if "priceCurrency":
    phone = soup.find_all(type="application/ld+json")

print(phone[1])

This is my code and this gives me the tag. I just want to scrap specific elements from it.




Aucun commentaire:

Enregistrer un commentaire