Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kannibalox committed Sep 12, 2018
1 parent c7e39b9 commit e618880
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
11 changes: 7 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,20 @@ Welcome to PTPAPI's documentation!

.. automodule:: ptpapi.api
:members:


.. automodule:: ptpapi.user
:members:

.. automodule:: ptpapi.movie
:members:

.. automodule:: ptpapi.torrent
:members:

.. automodule:: ptpapi.user
.. automodule:: ptpapi.session
:members:


Indices and tables
==================

Expand Down
3 changes: 1 addition & 2 deletions src/ptpapi/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""The entrypoint module for access the API"""
import re
import os
import json
import pickle
import logging

Expand Down Expand Up @@ -108,7 +107,7 @@ def search(self, filters):

def need_for_seed(self, filters={}):
"""List torrents that need seeding"""
data = util.snarf_cover_view_data(session.base_get("needforseed.php", params=filters).content)
data = ptpapi.util.snarf_cover_view_data(session.base_get("needforseed.php", params=filters).content)
torrents = []
for m in data:
torrent = m['GroupingQualities'][0]['Torrents'][0]
Expand Down
6 changes: 5 additions & 1 deletion src/ptpapi/util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import re
import json

from bs4 import BeautifulSoup as bs4
from six.moves import html_parser

def raise_for_cloudflare(text):
"""Raises an exception if a CloudFlare error page is detected
Expand All @@ -19,7 +23,7 @@ def snarf_cover_view_data(text):
for json_data in re.finditer(r'coverViewJsonData\[\s*\d+\s*\]\s*=\s*({.*});', text):
data.extend(json.loads(json_data.group(1))['Movies'])
for movie in data:
movie['Title'] = HTMLParser.HTMLParser().unescape(movie['Title'])
movie['Title'] = html_parser.HTMLParser().unescape(movie['Title'])
movie['Torrents'] = []
for group in movie['GroupingQualities']:
for torrent in group['Torrents']:
Expand Down

0 comments on commit e618880

Please sign in to comment.