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

KeyError when parsing for torrent information #4

Closed
bazmattaz opened this issue Dec 16, 2021 · 4 comments
Closed

KeyError when parsing for torrent information #4

bazmattaz opened this issue Dec 16, 2021 · 4 comments

Comments

@bazmattaz
Copy link

bazmattaz commented Dec 16, 2021

Hi there,

I've been trying to debug this and it looks like there is a KeyError thrown when trying to access the information for certain torrents.

I'm trying to grab the info on a torrent via this:
info = torrents.info(torrentId=897966)

and I get the following error. It doesnt happen on all torrents though only some.

  File "/Users/test.py", line 41, in download_from_1337x
    info = torrents.info(torrentId=897966)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/py1337x/py1337x.py", line 70, in info
    return parser.infoParser(response, baseUrl=self.baseUrl)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/py1337x/parser.py", line 67, in infoParser
    images = [i['data-original'] for i in images.find_all('img')] if images else None
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/py1337x/parser.py", line 67, in <listcomp>
    images = [i['data-original'] for i in images.find_all('img')] if images else None
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/bs4/element.py", line 1406, in __getitem__
    return self.attrs[key]
KeyError: 'data-original' 
@bazmattaz
Copy link
Author

Just to note, here is a torrentID that works fine;

info = torrents.info(torrentId=1338259)

@hemantapkh
Copy link
Owner

Which domain are you using? I just tried with the default one and it's working fine for me.

torrents = py1337x()
print(torrents.info(torrentId=897966))

{'name': 'Birth of the Living Dead 2013 DVDRip x264 AC3-MiLLENiUM', ....}

@hemantapkh
Copy link
Owner

Got it, you are using the older version, please update it to the latest version (1.2.2).

@bazmattaz
Copy link
Author

Yes an update fixed this. thank you

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

2 participants