Dec-21-2017, 11:13 AM
(This post was last modified: Dec-21-2017, 02:14 PM by sparkz_alot.)
After following the post named https://python-forum.io/Thread-Not-able-...-a-webpage
I used this code to pick up the data as you suggested, In the 'url' variable I am taking my facebook profile -
I used this code to pick up the data as you suggested, In the 'url' variable I am taking my facebook profile -
from bs4 import BeautifulSoup import requests url = 'https://www.facebook.com/srayashri.saha.5' url_get = requests.get(url) soup = BeautifulSoup(url_get.content,'lxml') print(soup.find(class_="_c24 _50f4").text)but I am getting the following error though there are several classes where text is present -
Error:[b]Traceback (most recent call last):
File "/home/csurv_4/PycharmProjects/web_parsing/data_fetching.py", line 18, in <module>
print(soup.find(class_= "_c24 _50f4").text)
AttributeError: 'NoneType' object has no attribute 'text'[/b]
I want to know the mistake I am doing, and what to do if there are multiple classes with the same name. How I can retrieve the all the data with that class name?