Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. from flask import Flask, render_template
  2. from bs4 import BeautifulSoup
  3. import requests
  4.  
  5. # urls = [
  6. #     {'2GO': 'http://edge.pse.com.ph/companyPage/stockData.do?cmpy_id=29'},
  7. #     {'HOUSE': 'http://edge.pse.com.ph/companyPage/stockData.do?cmpy_id=626'}
  8. # ]
  9.  
  10. urls = ['http://edge.pse.com.ph/companyPage/stockData.do?cmpy_id=29',
  11.         'http://edge.pse.com.ph/companyPage/stockData.do?cmpy_id=626']
  12.  
  13. for url in urls:
  14.     src = requests.get(url).text
  15.  
  16. soup = BeautifulSoup(src, 'lxml')
  17.  
  18. tables = soup.find_all('table')
  19. stock_price = tables[1].find('td').text.strip()
  20.  
  21. print(stock_price)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement