70172680

Date: 2021-11-30 16:29:34
Score: 4.5
Natty:
Report link

here is the original source code from udemy instructor:

from bs4 import BeautifulSoup as soupy

import urllib.request

import re

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

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

x = soup.find("meta", {"name":"description"})['content']

filter = re.findall(r'"(.*)"', x)

tweet = filter[0]

print(tweet)

this is also doesnt working it throw this error:

x = soup.find("meta", {"name":"description"})['content']

TypeError: 'NoneType' object is not subscriptable

Reasons:
  • Blacklisted phrase (1): doesnt work
  • Long answer (-0.5):
  • No code block (0.5):
  • Me too answer (2): this error
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Sem