-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_url.py
58 lines (47 loc) · 3.68 KB
/
get_url.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# ⣿⣿⣿⣿⣿⣿⣿⡿⢟⣫⣥⣶⣖⣲⣖⣲⡖⠉⠙⠛⢿⣿⣿⣿⣿⣿⣿⣿ #
# ⣿⣿⣿⣿⣿⢟⢍⣮⡷⠗⣊⣵⣾⣿⣿⣿⣷⣍⡳⢄⠀⠉⠻⢿⣿⣿⣿⣿ #
# File: get_url.py ⣿⣿⣿⠟⢁⣵⣷⣶⣶⠮⠿⠿⣿⣿⣿⣿⣿⢉⡻⢷⡄⠀⣠⣄⠻⣿⣿⣿ #
# ⣿⣿⢯⢮⣾⡿⣰⡟⡡⣪⣥⣶⡄⠰⣿⣿⣿⣮⣿⡎⣿⣶⡸⣿⡆⠙⣿⣿ #
# Project: anilist-visualizer ⣿⣏⠃⣿⣿⣿⡏⢱⣾⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣼⣿⣿⣷⣧⢠⡀⢸⣿ #
# Github: marsdevx ⣿⡈⢀⡏⣬⣿⣿⡜⣿⣿⣿⣿⣿⣿⢻⣿⣿⣿⣿⣯⣿⡻⣻⣻⡜⠇⢀⣿ #
# ⣧⠇⣾⣇⣫⡿⢿⣿⣌⣙⡛⢉⣽⣿⣿⣿⣿⣿⣿⣿⣿⢿⣜⢹⣿⠀⠈⣽ #
# Created: 11:07 08/01/2025 ⣿⠀⣿⣿⣿⣷⣾⣿⣿⣿⣿⣬⣿⣿⣿⣿⣿⣿⣿⣯⣾⣿⠿⡿⣀⡀⠀⣿ #
# Updated: 13:06 08/01/2025 ⣿⣇⢸⡿⣿⣿⢿⣿⣿⣿⣿⡻⣿⣿⣿⢻⣿⣿⣿⣿⡿⢡⡾⣻⣿⠃⢸⣿ #
# ⣿⣿⣄⢳⡹⣏⢟⣯⣷⣿⠛⣣⣭⡝⣿⣿⣿⣝⣻⡿⠷⠻⡁⡋⢀⢠⣿⣿ #
# Path: ./get_url.py ⣿⣿⣿⣆⠳⢀⡻⣿⣿⣿⣜⠻⡿⣉⣼⣿⡿⠿⠿⠛⠀⡀⠉⠐⣵⣿⣿⣿ #
# ⣿⣿⣿⣿⣷⣤⡈⠢⢝⡫⢿⣷⣽⣛⣛⣿⡶⠆⣀⠔⠋⢀⣤⣾⣿⣿⣿⣿ #
# ⣿⣿⣿⣿⣿⣿⣿⣶⣤⣍⣛⠈⠙⠉⠉⠡⠤⣤⣀⣤⣴⣿⣿⣿⣿⣿⣿⣿ #
import sys
import webbrowser
def print_help():
print("""
AniList Visualizer - A tool for visualizing your AniList data.
Usage:
1. Create Your AniList Client:
- Go to https://anilist.co/settings/developer
- Click "Create New Client."
- Fill in the "name" field (use any name) and leave the "redirect URL" blank.
- Click "Save" and copy the Client ID (a series of five numbers under the "ID" field).
2. Generate the Authorization URL:
Run the following command, replacing <id> with the Client ID:
python3 get_url.py <id>
This will generate a URL for authorization.
3. Authorize the Application:
- Open the generated URL in your browser.
- Click "Authorize" on the AniList authorization page.
- Copy the URL from the address bar.
4. Run the Main Program:
Run the following command, replacing <url> with the copied URL:
python3 anilist_viz.py <url>
This will fetch your AniList data and display the visualization.
""")
if len(sys.argv) != 2:
print_help()
sys.exit(1)
id = sys.argv[1]
if not id.isdigit():
print("Invalid ID format. It must be a positive integer.")
sys.exit(1)
oauth_url = f"https://anilist.co/api/v2/oauth/authorize?client_id={id}&response_type=token"
print("Opening the browser for OAuth authorization")
webbrowser.open(oauth_url)