Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with any requests #85

Open
3JIou opened this issue Mar 9, 2016 · 8 comments
Open

Problems with any requests #85

3JIou opened this issue Mar 9, 2016 · 8 comments

Comments

@3JIou
Copy link

3JIou commented Mar 9, 2016

import tpb

__author__ = 'batman'

t = tpb.TPB('https://thepiratebay.bid')
for torrent in t.top().category(tpb.CATEGORIES.VIDEO.MOVIES):
    print(torrent.files)

Connected to pydev debugger (build 143.1919)
Traceback (most recent call last):
  File "/root/.pycharm_helpers/pydev/pydevd.py", line 2411, in <module>
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/root/.pycharm_helpers/pydev/pydevd.py", line 1802, in run
    launch(file, globals, locals)  # execute the script
  File "/root/torrent_parser/tpb/tox-test.py", line 10, in <module>
    for torrent in t.top().category(tpb.CATEGORIES.VIDEO.MOVIES):
  File "/usr/local/lib/python2.7/dist-packages/tpb/tpb.py", line 59, in items
    request = urlopen(str(self.url))
  File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 437, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 550, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 475, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 558, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: Forbidden

if i will change url tpb.TPB('https://thepiratebay.bid') - result not changed. sorry for my english

@3JIou
Copy link
Author

3JIou commented Mar 9, 2016

i find problem - old code in pip repo

@3JIou
Copy link
Author

3JIou commented Mar 9, 2016

some any problem

@3JIou
Copy link
Author

3JIou commented Mar 9, 2016

for torrent in t.top().category(tpb.CATEGORIES.VIDEO.MOVIES):
    print(torrent)
Connected to pydev debugger (build 143.1919)
Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 2411, in <module>
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1802, in run
    launch(file, globals, locals)  # execute the script
  File "/Users/batman/Documents/projects/PycharmProjects/torrent_parser/tpb/tox-test.py", line 8, in <module>
    for torrent in t.top().category(tpb.CATEGORIES.VIDEO.MOVIES):
  File "/usr/local/lib/python2.7/site-packages/tpb/tpb.py", line 62, in items
    self._get_torrent_rows(root)]
  File "/usr/local/lib/python2.7/site-packages/tpb/tpb.py", line 89, in _build_torrent
    [category, sub_category] = [c.text for c in cols[0].findall('.//a')]
ValueError: too many values to unpack

./tpb.py
[category, sub_category] = [c.text for c in cols[0].findall('.//a')]
need try
like this

        try:
            [category, sub_category] = [c.text for c in cols[0].findall('.//a')]
        except ValueError:
            return

@Almoullim
Copy link

@3JIou How did you solved the urllib2.HTTPError: HTTP Error 403: Forbidden issue?

@advnpzn
Copy link

advnpzn commented Dec 23, 2020

Did you make sure piratebay is not blocked by your ISP in your region ?

@mattcar15
Copy link

I'm running into the same issue. It isn't blocked in my region

@advnpzn
Copy link

advnpzn commented Dec 26, 2020

Go through the source code of the API and find the URL and also check if piratebay has shifted to another domain.....

@mattcar15
Copy link

The urls are quite out of date. This library seems to be kinda abandoned?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants