import urllib.request, urllib.parse, urllib.error
import urllib.request, urllib.error, urllib.parse
from BeautifulSoup import BeautifulSoup
article = 'Albert Einstein'
article = urllib.parse.quote(article)
opener = urllib.request.build_opener()
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
resource = opener.open('http://en.wikipedia.org/wiki/' + article)
data = resource.read()
resource.close()
soup = BeautifulSoup(data)
print(soup.find('div', id='bodyContent').p)
Извлечь первый абзац из статьи Википедии (Python)