You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
673 B
Python
35 lines
673 B
Python
from bs4 import BeautifulSoup
|
|
import requests
|
|
|
|
def crawl_website(url):
|
|
response = requests.get(url)
|
|
soup = BeautifulSoup(response.content, 'html.parser')
|
|
return soup
|
|
|
|
def fetch_images(url):
|
|
soup = crawl_website(url)
|
|
divs = soup.find_all('div', class_="video-splash")
|
|
|
|
for div in divs:
|
|
style = div.get("style")
|
|
if style and "background-image" in style:
|
|
pass
|
|
|
|
|
|
def fetch_all_links(url):
|
|
soup = crawl_website(url)
|
|
links = soup.find_all('a')
|
|
for link in links:
|
|
href = link.get("href")
|
|
print(href)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
url = 'https://masterbate.io'
|
|
fetch_images(url)
|