mardi 30 novembre 2021

AttributeError: 'NoneType' object has no attribute 'getText'

I took a udemy course where instructor teach about how to get user tweet.

when i run code it gives me AttributeError: 'NoneType' object has no attribute 'getText'

not getting good support on udemy so kindly anyone please make this code work. Thank you

=====================================================================

from bs4 import BeautifulSoup as soupy

import urllib.request
import re

html = urllib.request.urlopen('https://twitter.com/samad_bloch0x1').read()

soup = soupy(html, features="html.parser",)

x = soup.find('p', {'class':'js-tweet-text'}).getText()

filter = re.findall(r'"(.*)"', x)ut
tweet = filter[0]  

print(tweet)

=============================================================================== Here i pasted whole code, please help me to make this working, Thanks.




Aucun commentaire:

Enregistrer un commentaire