What happens?
First at all, take a closer look into your soup - There is the truth.
None
is returned, cause beautifulsoup
could not find the element you try to select - So are you sure there is an element with such this class js-tweet-text
in the source and the soup?
Follwowing could also be a reason:
JavaScript is not available.
We’ve detected that
JavaScript is disabled in this browser. Please enable JavaScript or
switch to a supported browser to continue using twitter.com. You can
see a list of supported browsers in our Help Center.
What can you do?
use offical api
use proxies
try to use selenium
Example Selenium 4
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
options = webdriver.ChromeOptions()
service = ChromeService(executable_path='YOUR PATH TO CHROMEDRIVER')
driver = webdriver.Chrome(service=service, options=options)
driver.get('https://twitter.com/samad_bloch0x1')
# if selenium is to slow you may have to wait -> https://www.selenium.dev/documentation/webdriver/waits/
soup = BeautifulSoup(driver.page_source,'html.parser')
print(soup.select('[data-testid="tweet"]'))
driver.close()