Skip to content

Commit

Permalink
GA
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmfinol committed Sep 22, 2024
1 parent 86af095 commit 32fcc3e
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 124 deletions.
18 changes: 14 additions & 4 deletions docs/games/grand_archive_gabrary_spoilers/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,31 @@
# List to store card data
card_data = {}
card_data["data"] = []
name_counter = {}

# Loop through each card element
for card in cards:
print(card)
# Extract card name and image URL
name = card.find('p', class_="centerText").text.strip()
image_url = 'https://gabrary.net' + card.find('img')['src']

image_url = 'https://cgs.games/api/proxy/gabrary.net' + card.find('img')['src']

# Massaging for CGS
name_count = 0
if (name in name_counter):
name_count = name_counter[name]
name_count = name_count + 1
name_counter[name] = name_count
name_counted = name
if (name_count > 1):
name_counted = name + str(name_count)
editions = []
editions.append({'set': { 'name': 'Spoilers from https://gabrary.net', 'prefix': 'gabrary_spoilers'}})

# Append to card_data list
card_data["data"].append({
'uuid': re.sub(r'\W+', '', name),
'name': name,
'uuid': re.sub(r'\W+', '', name_counted),
'name': name_counted,
'image_url': image_url,
'editions': editions
})
Expand Down
Loading

0 comments on commit 32fcc3e

Please sign in to comment.