how to split any url and get only source?

I want to split https://abcnews.go.com/ this type of Url.

Want to get abcnews

I used:

.split('//')[1].split('www.')[1].split('.com')[0].split('.org')[0].split('.edu')[0].split('.info')[0]

I get error can not split.

Any idea how to do it?

16 thoughts on “how to split any url and get only source?”

Leave a Comment