Skip to content

Instantly share code, notes, and snippets.

@ugeugeHigh
Created January 8, 2023 08:45
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
import requests
from bs4 import BeautifulSoup
class switch_s:
def __init__(self):
global soup
url = "https://www.switch-science.com/products/8522"
r = requests.get(url)
soup = BeautifulSoup(r.content,"html.parser")
def stock(self):
global soup
tmp = soup.find_all('p')
a = str(tmp[5])
tmp1 = a.split('>')
tmp2 = tmp1[1].split('<')
stock = str(tmp2[0])
return stock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment