Skip to content

Commit 74b365f

Browse files
committed
change code style for ai checks
1 parent 7b2fd87 commit 74b365f

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

Apple-Music-Scraper/main.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ def room_scrape(link="https://music.apple.com/us/room/6748797380"):
2020
2121
Notes
2222
-----
23-
This function parses the `serialized-server-data` script tag within
24-
the Apple Music room HTML, locates the 'copper-track-swoosh' section,
23+
This function parses the `serialized-server-data` script tag within
24+
the Apple Music room HTML, locates the 'copper-track-swoosh' section,
2525
and extracts track URLs.
2626
"""
2727
result = []
@@ -222,9 +222,9 @@ def search(keyword="sasha sloan"):
222222
)
223223
result["albums"].append(
224224
{
225-
"title": title,
226-
"artist": artist,
227-
"url": url,
225+
"title": title,
226+
"artist": artist,
227+
"url": url,
228228
"image": img
229229
}
230230
)
@@ -247,7 +247,7 @@ def search(keyword="sasha sloan"):
247247
{
248248
"title": title,
249249
"artist": artist,
250-
"url": url,
250+
"url": url,
251251
"image": img
252252
}
253253
)
@@ -420,7 +420,8 @@ def song_scrape(url="https://music.apple.com/us/song/california/1821538031"):
420420

421421
def album_scrape(url="https://music.apple.com/us/album/1965/1817707266?i=1817707585"):
422422
"""
423-
Scrape an Apple Music album page and extract metadata, songs, related albums, videos, etc.
423+
Scrape an Apple Music album page
424+
and extract metadata, songs, related albums, videos, etc.
424425
425426
Parameters
426427
----------
@@ -766,7 +767,7 @@ def artist_scrape(url="https://music.apple.com/us/artist/king-princess/134996853
766767
767768
Notes
768769
-----
769-
This is the most complex scraper and extracts ~12 different sections
770+
This is the most complex scraper and extracts ~12 different sections
770771
from the artist page.
771772
"""
772773
result = {
@@ -1001,7 +1002,6 @@ def test_all_functions():
10011002
- Counts of returned items.
10021003
- Key fields such as title, preview-url existence, etc.
10031004
"""
1004-
10051005
print("\n=== TEST: room_scrape ===")
10061006
try:
10071007
r = room_scrape()
@@ -1068,5 +1068,3 @@ def test_all_functions():
10681068
print("artist_scrape ERROR:", e)
10691069

10701070
print("\n=== ALL TESTS COMPLETED ===")
1071-
1072-
test_all_functions()

Apple-Music-Scraper/utils.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66

77
def get_cover(url, width, height, img_format="jpg", crop_option=""):
88
"""
9-
Generate a full Apple Music artwork URL with proper width, height, format, and crop settings.
9+
Generate a full Apple Music artwork URL\
10+
with proper width, height, format, and crop settings.
1011
1112
Parameters
1213
----------
1314
url : str
14-
The original Apple Music artwork template URL containing `{w}`, `{h}`, `{f}`, `{c}`.
15+
The original Apple Music artwork template URL
16+
containing `{w}`, `{h}`, `{f}`, `{c}`.
1517
width : int or str
1618
Target width of the image.
1719
height : int or str
@@ -53,7 +55,8 @@ def convert_album_to_song_url(album_url):
5355
Parameters
5456
----------
5557
album_url : str
56-
Full Apple Music album URL that contains a track ID via the query parameter `?i=...`.
58+
Full Apple Music album URL that
59+
contains a track ID via the query parameter `?i=...`.
5760
5861
Returns
5962
-------

0 commit comments

Comments
 (0)