I want to scrape only the content from the data <meta itemprop="url" content="http://www.vestiairecollective.com/women-bags/handbags/chanel/black-timeless-leather-handbag-chanel-2668779.shtml">
i.e only the http part. But the way I am doing it, gets me the the the whole data as a result starting from "meta".
Here is my script logic:-
import urllib.request
from bs4 import BeautifulSoup
url=urllib.request.urlopen("http://www.vestiairecollective.com/women-bags/handbags/#_=catalog")
soup=BeautifulSoup(url.read(),"html.parser")
getdata=soup.find_all("div",{"class":"expand-snippet-container"})
for i in getdata:
data1=i.find_all("meta",{"itemprop":"url"})
datac=[da[0] for da in data1]
print(datac1)
for i in getdata:
data1=i.find_all("p",{"class":"brand"})
datac1=[da.contents[0] for da in data1]
brdata=("\n".join(datac1))
if brdata=="CHANEL":
da1=i.find_all("meta",{"itemprop":"url"})
print(da1)
In the last print statement, I need only the url to show (example http://www.vestiairecollective.com/women-bags/handbags/chanel/black-timeless-leather-handbag-chanel-2668779.shtml
. What am I doing wrong? Please help.