@ML1012018ZHENG/

another_scraper

Python

No description

fork
loading
Files
  • main.py
  • something.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import urllib.request
from bs4 import BeautifulSoup

def main():
  dom = input("what site: ")
  site = input("website: ")
  if dom == "sparknotes":
    sparknotes(site)
main()

def sparknotes(website):
  separ = site
  webUrl  = urllib.request.urlopen(website)
  data = webUrl.read()
  soup = BeautifulSoup(data)
  mydef = soup.find("div", {"class": "content_txt"})
  f = open("sparknotes/" + back, "w+")
  f.write(str(mydef.text))
  f.close()