Closed vikstrous closed 9 years ago
Now I get this sometimes when I have unreliable internet:
Traceback (most recent call last):
File "./pirate-get.py", line 686, in <module>
main()
File "./pirate-get.py", line 579, in main
print_search_results(mags, sizes, uploaded, local=args.database)
File "./pirate-get.py", line 349, in print_search_results
torrent_name = parse.unquote(name.group(1)).replace('+', ' ')
AttributeError: 'NoneType' object has no attribute 'group'
I noticed this some time ago but I wasn't able to reproduce it. It also seems related to the proxy used.
I found one of the mirrors that is giving this problem.
Basically there is no magnet uri found: this is the magnet parsed ['', '346', '51']
That means the regex for the magnet in remote(args, mirror)
is not working:
found = re.findall(r'"(magnet\:\?xt=[^"]*)|<td align="right">'
r'([^<]+)</td>', res)
Sweet. If you can figure out which mirror it is and what the html looks like, it'll probably be a simple fix. We might want to switch to not using regex though :P That might also solve the problem.
It's not our fault. The page is missing all the magnets! The magnet icon is just a link to the torrent page. https://thepirateboat.eu/s/?q=&page=0&orderby=99
I blacklisted thebay.tv for this reason: https://github.com/vikstrous/pirate-get/commit/398614704d40a83c01f668d3fdbc503d7fcb167d
We can handle this case by storing the url to the torrent page and then getting the magnet link only after you choose the torrent. This is a weird thing to have to detect and I don't know why some mirrors do this.
In other news, thebay.tv seems to open popups that immediately close themselves periodically. I suspect that it's malware attempting to exploit the browser, a DDoS attack or fake ad views. I haven't investigated, but this whole mirror business is not great. The pirate bay has a .onion domain, so maybe we can detect a local tor instance and use that instead of mirrors whenever we can.
Nothing to be done here...