#!/usr/bin/Env python3 import urllib.request from bs4 import BeautifulSoup def get_html(url): response = urllib.request.urlopen(url) return response.read() def parse(html): soup = BeautifulSoup(html) td = soup.find('td', class_='eMessage') print(td.prettify()) def main(): parse(get_html('http://4inana.ucoz.ru/news/giga_plamja_serdec_ft_aj_man/2014-12-05-108')) if __name__ == '__main__': main() 

I can not get to the text. How to pull out the text itself?

  • What text do you want to get to? - Dmitry Erohin
  • The text of the material, specifically for this example, the text of the song) if you go then you will understand me) - Venome

1 answer 1

This is how the lyrics come back:

 #!/usr/bin/Env python3 import urllib.request from bs4 import BeautifulSoup def get_html(url): response = urllib.request.urlopen(url) return response.read() def parse(html): soup = BeautifulSoup(html) td = soup.find('td', class_='eMessage') print(td.text.split('}')[1]) def main(): parse(get_html('http://4inana.ucoz.ru/news/giga_plamja_serdec_ft_aj_man/2014-12-05-108')) if __name__ == '__main__': main()