I have a regex, which tries to match href attribute in HTML. Href is between a script tag and in a function. I have the correct regex I think, but the result is not complete, it is cut in half.
I have tried the regex on multiple Python Regex testing sites and all give the correct result, but when tried in my own script, it gives an unfinished result.
def gotoDownload(link):
try:
with requests.Session().get(link) as download:
if isUrlOnline(download):
soup = BeautifulSoup(download.content, 'html.parser')
filtered = soup.find_all('script')
print(re.search(r"\'http[\s=[\s\"\']*(.*?)[\"\']*.*?\'", filtered[17].text))
The expected result of a link should be: 'http://mediafile.cloud/b34b4f6720a31f73?pt=UkhBMmVHczFaRXA2Uld4ek1qYzVWME5DYzNodVFUMDlPampsTkQ5aFNpVWxQamVlZ3REQkpEdz0%3D'
But the output is: match="'http://mediafile.cloud/b34b4f6720a31f73?pt=UkhBM
It is cut in half, ends after the =UkhBM for some reason.