all. I am learning more about coding and tkinter and Python in general and I want to create a currency converter. I have got the converter working like I want, but I want to add the USD to EUR chart from this website into my GUI:
https://www.xe.com/currencyconverter/convert/?Amount=1&From=USD&To=EUR
Can I please get suggestions on how to go about doing that?
I have already used
import urllib.request
from bs4 import BeautifulSoup
html_code = urllib.request.urlopen(url).read()
self.soup = BeautifulSoup(html_code, 'html.parser')
self.result = self.soup.find('span', {'class': "uccResultAmount"}).string
to get some information from the website.
Thanks
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
i am new to web scraping and i have been trying to scrape the text content that comes up when i hover my mouse on the 8g located on the background image from this site: https://www.dietdoctor.com/recipes/sullivans-kedough-breakfast-pizza but all my effort with beautifulSoup is futile.
please how do i go about this.
Thanks in advance.
This is the link the image that describe where the mouse hover content is located:
i have tried these following codes suggested by #Andrrej kesely
import requests
from bs4 import BeautifulSoup
url = 'https://www.dietdoctor.com/recipes/sullivans-kedough-breakfast-pizza'
soup = BeautifulSoup(requests.get(url).content, 'html.parser')
soup = BeautifulSoup(soup.select_one('.recipe-energy-mark-wrapper[data-js-popup]')['data-js-popup'], 'html.parser')
# print some data to screen:
for t in soup.select('title'):
print(t.text)
but it keeps giving TypeError: 'NoneType' object is not subscriptable
import requests
from bs4 import BeautifulSoup
url = 'https://www.dietdoctor.com/recipes/sullivans-kedough-breakfast-pizza'
response = requests.get(url)
# Takes the html source and feeds into BeautifulSoup object
soup = BeautifulSoup(response.text, 'html.parser')
# In the 'soup' object, we'll select the the first element with class ".recipe-energy-mark-wrapper"
# Within that element, the data is the value of the attribute 'data-js-popup'
jsPopup = soup.select_one('.recipe-energy-mark-wrapper')['data-js-popup']
# Normally you probably wouldn't need this part, but that value is stored as the html string
# that we are after, so we'll feed that string into BeautifulSoup to parse that html
soup = BeautifulSoup(jsPopup, 'html.parser')
print (soup.text, '\n')
for t in soup.select('title'):
print(t.text)
I am trying to make a bot that can play Cookie Clicker. I have successfully opened the website using the webbrowser module. When I use the developer tool to see the html I can see the information I want to obtain, such as how much money I have, how expensive items are ect. But when I try to get that information using the requests and beautifulsoup it instead gets the html of a new window. How can I make it so that I get the html of the already opened tab?
import webbrowser
webbrowser.open('https://orteil.dashnet.org/cookieclicker/')
from bs4 import BeautifulSoup
import requests
def scrape():
html = requests.get('https://orteil.dashnet.org/cookieclicker/')
print(html)
scrape()
You can try to do this:
body_element = html.find_element_by_xpath("//body")
body_content = body_element.get_attribute("innerHTML")
print(body_content)
I am trying to scrape surfline.com using python3 with beautiful soup and requests. I am using this bit of code. Additionally I am using spyder 3.7. Also I am fairly new to webscraping.
import requests
from bs4 import BeautifulSoup
url = 'https://www.surfline.com/surf-report/salt-creek/5842041f4e65fad6a770882e'
r = requests.get(url)
html_soup = BeautifulSoup(r.text,'html.parser')
print(html_soup.prettify())
The goal is to scrape the surf height for each day. Using inspect I found the HTML section that contains the wave height. screen shot of surfline website & HTML . I run the code and it prints out the HMTL of the website. When I do ctrl find to look for the section I want to scrape it is not there. My question is why is it not being printed out and how do I fix it. I am aware that some website use java to load data onto website, is that the case here.
Thank you for any help you can provide.
I am trying to scrape the pages of anime tv series for my side project and stuck with this small issue where I am not able to extract a complete div tag.
link: https://gogoanime.in/category/boruto-naruto-next-generations
I am trying to scrape this thing here:
enter image description here
The code I am using is this:
from bs4 import BeautifulSoup
trialURL = 'https://gogoanime.in/category/boruto-naruto-next-generations'
#completeAnimeList_df.URL[0]
page = simple_get(trialURL)
soup = BeautifulSoup(page,'html.parser')
#working on number of comments
divComment = soup.find('span', attrs={"class" : "comment-count"})
print(divComment.get_text)
I am getting a NoneType output after running the code. Please let me know what could be done.
I was trying to get the best search result position of few product in the below link
https://www.purplle.com/search?q=hair%20fall%20shamboo
I used below tools to get the html details from the page
++
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://www.purplle.com/search?q=hair%20fall%20shamboo")
from bs4 import BeautifulSoup
soup = BeautifulSoup(driver.page_source, 'html.parser')
driver.quit()
++
now I am confused how to get the product names and position(to get the best rank in the search )from this html.
I used the below method to get the details of the products but the output has a lot of unwanted things too.
details = soup.find('div', attrs={'class': 'pr'})
any idea how to solve this?
I don't know what you meant by position. However, the below script can fetch you the title of different products and its position (allegedly) from that page:
from selenium import webdriver
from bs4 import BeautifulSoup
driver = webdriver.Chrome()
driver.get("https://www.purplle.com/search?q=hair%20fall%20shamboo")
soup = BeautifulSoup(driver.page_source, 'html.parser')
for item in soup.find_all(class_="prd-lstng pr"):
name = item.find_all(class_="pro-name el2")[0].text
position = item.find_all(class_="mrl5 tx-std30")[0].text
print(name,position)
driver.quit()