viking_unet

parse investing.com

Aug 24th, 2020
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. import requests
  2. from bs4 import BeautifulSoup as BS
  3.  
  4. #Прсинг инвестинга "Вся Россия" название акции и текущая (последняя) цена
  5. r = requests.get('https://ru.investing.com/equities/russia',
  6.                  headers = {'user-agent' : 'Chrome'})
  7. html = BS(r.text, 'html.parser')
  8.  
  9. for el in html.find_all('div', attrs={"class": "buttonLine"}):#
  10.     options = el.find_all('option')
  11.     for option in options:
  12.         print(option['id'], option.get('selected'), option.text)
  13.  
Add Comment
Please, Sign In to add comment