@@ -716,3 +716,70 @@ def artist_scrape(url="https://music.apple.com/us/artist/king-princess/134996853
716716 pass
717717
718718 return result
719+
720+ def test_all_functions ():
721+ """
722+ Test all scraper functions with sample URLs.
723+ Prints results count / key fields to verify basic functionality.
724+ """
725+
726+ print ("\n === TEST: room_scrape ===" )
727+ try :
728+ r = room_scrape ()
729+ print ("Room items:" , len (r ))
730+ except Exception as e :
731+ print ("room_scrape ERROR:" , e )
732+
733+ print ("\n === TEST: playlist_scrape ===" )
734+ try :
735+ p = playlist_scrape ()
736+ print ("Playlist items:" , len (p ))
737+ except Exception as e :
738+ print ("playlist_scrape ERROR:" , e )
739+
740+ print ("\n === TEST: search ===" )
741+ try :
742+ s = search ("night tapes" )
743+ print ("Artists:" , len (s .get ("artists" , [])))
744+ print ("Albums:" , len (s .get ("albums" , [])))
745+ print ("Songs:" , len (s .get ("songs" , [])))
746+ print ("Playlists:" , len (s .get ("playlists" , [])))
747+ print ("Videos:" , len (s .get ("videos" , [])))
748+ except Exception as e :
749+ print ("search ERROR:" , e )
750+
751+ print ("\n === TEST: song_scrape ===" )
752+ try :
753+ song = song_scrape ("https://music.apple.com/us/song/california/1821538031" )
754+ print ("Song title:" , song .get ("title" ))
755+ print ("Preview URL exists:" , bool (song .get ("preview-url" )))
756+ except Exception as e :
757+ print ("song_scrape ERROR:" , e )
758+
759+ print ("\n === TEST: album_scrape ===" )
760+ try :
761+ album = album_scrape ("https://music.apple.com/us/album/1965/1817707266?i=1817707585" )
762+ print ("Album title:" , album .get ("title" ))
763+ print ("Songs:" , len (album .get ("songs" , [])))
764+ except Exception as e :
765+ print ("album_scrape ERROR:" , e )
766+
767+ print ("\n === TEST: video_scrape ===" )
768+ try :
769+ video = video_scrape ("https://music.apple.com/us/music-video/gucci-mane-visualizer/1810547026" )
770+ print ("Video title:" , video .get ("title" ))
771+ print ("Video URL exists:" , bool (video .get ("video-url" )))
772+ except Exception as e :
773+ print ("video_scrape ERROR:" , e )
774+
775+ print ("\n === TEST: artist_scrape ===" )
776+ try :
777+ artist = artist_scrape ("https://music.apple.com/us/artist/king-princess/1349968534" )
778+ print ("Artist title:" , artist .get ("title" ))
779+ print ("Top songs:" , len (artist .get ("top" , [])))
780+ print ("Albums:" , len (artist .get ("albums" , [])))
781+ print ("Videos:" , len (artist .get ("videos" , [])))
782+ except Exception as e :
783+ print ("artist_scrape ERROR:" , e )
784+
785+ print ("\n === ALL TESTS COMPLETED ===" )
0 commit comments