-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWebScraper.py
34 lines (21 loc) · 1018 Bytes
/
WebScraper.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
import requests
from bs4 import BeautifulSoup
import smtplib
URL='https://www.amazon.com/G-Shock-Combi-Military-Watch-Black/dp/B003WPUU0U/ref=cts_wa_1_vtp'
headers={"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134', 'Cache-Control': 'no-cache', "Pragma": "no-cache"}
page=requests.get(URL, headers=headers)
#soup=BeautifulSoup(page.content, 'html.parser')
#price = soup.find(id = "productTitle")
soup = BeautifulSoup(page.content, 'html.parser')
soup1 = BeautifulSoup(soup.prettify(), "html.parser")
title = soup1.find(id="productTitle")
print(title)
server=smtplib.SMTP("smtp.gmail.com", 587)
#server.ehlo()
server.starttls()
#server.ehlo()
server.login("[email protected]", 'iupnlqwvvopnmnhu')
server.sendmail('[email protected]','[email protected]', "testing")
print('email sent')
server.quit()
#headers = {'Cache-Control': 'no-cache', "Pragma": "no-cache"}