-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
46 lines (31 loc) · 1.04 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from flask import Flask, render_template
import requests
#===============
from selenium import webdriver
browse_options = webdriver.ChromeOptions()
browse_options.add_argument('--headless')
browse_options.add_argument('--no-sandbox')
browse_options.add_argument('--disable-dev-shm-usage')
#login
url='https://www.rottentomatoes.com/browse/in-theaters'
browser = webdriver.Chrome('chromedriver',chrome_options= browse_options)
#===============
app = Flask(__name__)
@app.route('/')
def hello_world():
browser.get(url)
time.sleep(1.5)
for stuff in browser.find_elements_by_class_name("movieTitle"):
listofmovies.append(stuff.text)
finalresult = "<p>"
i=1
for movie in listofmovies:
finalresult = finalresult + str(i) + ". " + movie + "<br/>"
i+=1
if i>=15:
break
finalresult = finalresult + "</p>"
return finalresult
# return render_template("index.html")
if __name__ == '__main__':
app.run(host='0.0.0.0')