I'm scraping web but I'm stack with an error and I failed to handle it
I've the following url but can't work for me to make it work require to remove all characters
after jpg
and I tried it with regular expression but I couldnt and I dont want to count
overflowing characters and index on url to remove it because it will not work on all
of image
https://upload.wikimedia.org/wikipedia/commons/2/25/Lebron_wizards_2017_%28cropped%29.jpg/498px-Lebron_wizards_2017_%28cropped%29.jpg
this is the code I've tried so far
regex = re.sub('[^*\w]/+\w', '', image)
# and
sep = 'jpg/'
rest = image.split(sep, 1)[0]
print(rest)
but I failed and I also check here this question but I can't find any solution because of my url contains weird and similar characters.
an expected result looks like this
https://upload.wikimedia.org/wikipedia/commons/2/25/Lebron_wizards_2017_%28cropped%29.jpg