Skip to content

Commit

Permalink
Updated some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
johnvictorfs committed Oct 27, 2019
1 parent 254d6a9 commit efe1e09
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 6 deletions.
7 changes: 5 additions & 2 deletions anilist.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ def fetch_user_list(username: str, token: str) -> list:
'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, json={'query': query, 'variables': variables})
return response.json().get('data').get('MediaListCollection').get('lists')
response = requests.post(url, headers=headers, json={
'query': query, 'variables': variables})
if response:
return response.json().get('data').get('MediaListCollection').get('lists')
return []


def fetch_watching(user_list: list) -> list:
Expand Down
6 changes: 3 additions & 3 deletions anime_feed.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from guessit import guessit
from fuzzywuzzy import fuzz

from difflib import SequenceMatcher
import logging

logger = logging.getLogger('anime_downloader')
Expand All @@ -15,8 +15,8 @@ def search_title(feed, search: dict, size: int = 720, episode: int = None):
if search.get(lang):
search_guess = guessit(search.get(lang))
lookup = search_guess.get('title')
ratio = SequenceMatcher(None, name, lookup).ratio()
if ratio > 0.75:
ratio = fuzz.token_set_ratio(name, lookup)
if ratio > 75:
logger.info(
f"[PARSER] Found {ratio * 100:2f}% RSS match for Anime: '{name}' ({lang} title) "
f"E{title.get('episode')}"
Expand Down
48 changes: 47 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ python = "^3.7"
feedparser = "^5.2"
requests = "^2.22"
guessit = "^3.0"
fuzzywuzzy = {version = "^0.17.0",extras = ["speedup"]}

[tool.poetry.dev-dependencies]
autopep8 = "^1.4"

[build-system]
requires = ["poetry>=0.12"]
Expand Down

0 comments on commit efe1e09

Please sign in to comment.