Advertisement
jagata

Parse currency price from google

Jul 13th, 2022
1,267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. import requests as r
  2. from bs4 import BeautifulSoup
  3.  
  4. headers = {
  5.     "User-Agent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:100.0) Gecko/20100101 Firefox/100.0"
  6. }
  7.  
  8. resp = r.get("https://www.google.com/search?q=usd%20to%20gel",headers=headers)
  9. if resp.status_code == 200:
  10.     soup = BeautifulSoup(resp.text,"html.parser")
  11.     price = soup.find("div",{"id":"knowledge-currency__updatable-data-column"}).find("span",{"class":"DFlfde SwHCTb"}).text
  12.     print(price)
  13.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement