mirror of
https://github.com/vikstrous/pirate-get
synced 2025-01-10 10:04:21 +01:00
Merge pull request #11 from vikstrous/200-block-detect
detect blocked mirrors even when error code is 200
This commit is contained in:
commit
1b48475623
@ -72,6 +72,13 @@ def main():
|
|||||||
res = f.read()
|
res = f.read()
|
||||||
found = re.findall(""""(magnet\:\?xt=[^"]*)|<td align="right">([^<]+)</td>""", res)
|
found = re.findall(""""(magnet\:\?xt=[^"]*)|<td align="right">([^<]+)</td>""", res)
|
||||||
|
|
||||||
|
# check for a blocked mirror
|
||||||
|
no_results = re.search(""""No hits\.""", res)
|
||||||
|
if found == [] and not no_results is None:
|
||||||
|
# Contradiction - we found no results, but the page didn't say there were no results
|
||||||
|
# the page is probably not actually the pirate bay, so let's try another mirror
|
||||||
|
raise Exception("Blocked mirror detected.")
|
||||||
|
|
||||||
# get sizes as well and substitute the character
|
# get sizes as well and substitute the character
|
||||||
# print res
|
# print res
|
||||||
sizes = [ match.replace(" ", " ") for match in re.findall("(?<=Size )[0-9.]+\ \;[KMGT]*[i ]*B",res) ]
|
sizes = [ match.replace(" ", " ") for match in re.findall("(?<=Size )[0-9.]+\ \;[KMGT]*[i ]*B",res) ]
|
||||||
|
Loading…
Reference in New Issue
Block a user