Compare commits
No commits in common. "8a5dc238a192386ad30a349d94625bd3d95d3994" and "3997fd814d485eb2a82563c3a39e8e29b8ec4c39" have entirely different histories.
8a5dc238a1
...
3997fd814d
@ -1,2 +0,0 @@
|
|||||||
beautifulsoup4==4.12.2
|
|
||||||
pybomb==0.4.0
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
import pybomb
|
|
||||||
from bs4 import BeautifulSoup
|
|
||||||
|
|
||||||
class GameSearch:
|
|
||||||
def __init__(self, api_key):
|
|
||||||
self.games_client = pybomb.GamesClient(api_key)
|
|
||||||
|
|
||||||
def quick_search(self, name, platform=None):
|
|
||||||
response = self.games_client.quick_search(
|
|
||||||
name=name.strip(),
|
|
||||||
platform=platform,
|
|
||||||
sort_by='original_release_date',
|
|
||||||
desc=True
|
|
||||||
)
|
|
||||||
return response
|
|
||||||
|
|
||||||
def get_name(self, response):
|
|
||||||
return response.results[0]['name']
|
|
||||||
|
|
||||||
def get_overview(self, response):
|
|
||||||
description_html = response.results[0]['description']
|
|
||||||
soup = BeautifulSoup(description_html, 'html.parser')
|
|
||||||
overview_heading = soup.find('h2', string='Overview')
|
|
||||||
overview_text = overview_heading.find_next_sibling().get_text()
|
|
||||||
return overview_text
|
|
||||||
|
|
||||||
def get_icon_url(self, response):
|
|
||||||
return response.results[0]['image']['icon_url']
|
|
||||||
|
|
||||||
def get_deck(self, response):
|
|
||||||
return response.results[0]['deck']
|
|
||||||
Loading…
x
Reference in New Issue
Block a user