예제 #1
0
    def get(cls):
        email = Email.get_instance()
        r = requests.get(cls.ORIGIN)
        soup = BeautifulSoup(r.text, "html.parser")
        for post in soup.find_all("article"):
            header = post.find("header", attrs={"class": "post-header"})
            a = header.find("a")
            subject = f'[RisingStack] {a.get_text()}'
            link = f'{cls.ORIGIN}{a.get("href")}'
            section = post.find("section", attrs={"class": "post-content"})
            content = f'''
			<html>
				<body>
					<p>{section.get_text()}</p>
					<a href="{link}">{link}</a>
				</body>
			</html>
			'''
            email.send(subject, content)
            time.sleep(10)
예제 #2
0
파일: server.py 프로젝트: ocleo1/digest
def digesting():
    email = Email.get_instance()
    email.login()
    blogs.RisingStack.get()
    email.quit()