Skip to content
This repository was archived by the owner on May 25, 2022. It is now read-only.

Commit 7c23be8

Browse files
Update projects/Scraping Medium Articles/scraping_medium.py
Co-authored-by: Ravishankar Chavare <[email protected]>
1 parent 50d5b4d commit 7c23be8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

projects/Scraping Medium Articles/scraping_medium.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
def get_page():
1212
url = input('Enter url of a medium article: ')
1313
# handling possible error
14-
if (url[:18] != 'https://medium.com/') and (url[:17] != 'http://medium.com'):
14+
if not re.match(r'https?://medium.com/',url):
1515
print('Please enter a valid website, or make sure it is a medium article')
1616
sys.exit(1)
1717
res = requests.get(url)
@@ -63,4 +63,4 @@ def save_file(fin):
6363
if __name__ == '__main__':
6464
url, soup = get_page()
6565
fin = collect_text(url, soup)
66-
save_file(fin)
66+
save_file(fin)

0 commit comments

Comments
 (0)