diff --git a/main.py b/main.py index f30e8f4619b4ca10cafad6f16dc783882049d4e6..d5860d51810b0ae660fcaf2dc219a14e700a92cf 100644 --- a/main.py +++ b/main.py @@ -1,20 +1,8 @@ -import requests -from bs4 import BeautifulSoup +from redlines import Redlines -url = 'http://quote.eastmoney.com/ztb' -try: - res = requests.get(url, timeout=5) - soup = BeautifulSoup(res.text, 'html.parser') -except requests.exceptions.RequestException as e: - print(e) - exit() -print(soup) -hot_stocks = soup.select('#ztgc-box a') -print(hot_stocks) -if hot_stocks: - for stock in hot_stocks: - name = stock.select_one('.title a').text - code = stock.select_one('.title span').text - print(name, code) -else: - print('No hot stocks found.') +test = Redlines("The quick brown fox jumps over the lazy dog.") +assert test.compare( + 'The quick brown fox walks past the lazy dog.') == "The quick brown fox jumps over walks past the lazy dog." + +assert test.compare( + 'The quick brown fox jumps over the dog.') == 'The quick brown fox jumps over the lazy dog.' \ No newline at end of file