{"id":18557506,"url":"https://github.com/brenns10/tswift","last_synced_at":"2025-10-07T04:33:20.888Z","repository":{"id":36689767,"uuid":"40996257","full_name":"brenns10/tswift","owner":"brenns10","description":"MetroLyrics API for Python","archived":false,"fork":false,"pushed_at":"2024-04-09T07:02:45.000Z","size":39,"stargazers_count":52,"open_issues_count":1,"forks_count":15,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-12-16T04:10:47.546Z","etag":null,"topics":["lyrics","python","scrape","taylor-swift"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brenns10.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-08-18T20:36:06.000Z","updated_at":"2024-04-24T17:35:30.000Z","dependencies_parsed_at":"2024-06-18T22:57:25.732Z","dependency_job_id":null,"html_url":"https://github.com/brenns10/tswift","commit_stats":{"total_commits":39,"total_committers":8,"mean_commits":4.875,"dds":0.5384615384615384,"last_synced_commit":"a391008a28d00a4b42d982af91d908e7fb97fad3"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brenns10%2Ftswift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brenns10%2Ftswift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brenns10%2Ftswift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brenns10%2Ftswift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brenns10","download_url":"https://codeload.github.com/brenns10/tswift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230382858,"owners_count":18216854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lyrics","python","scrape","taylor-swift"],"created_at":"2024-11-06T21:37:14.004Z","updated_at":"2025-10-07T04:33:20.809Z","avatar_url":"https://github.com/brenns10.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"GOODBYE CRUEL WORLD\n===================\n\nI'm sorry to report that, as of June 29, 2021, `Metrolyrics has mysteriously\ngone offline \u003chttps://en.wikipedia.org/wiki/MetroLyrics\u003e`_. As a result, **this\npackage is functionally dead and useless.** If you use it, you'll probably get\nan exception like the following:\n\n.. code::\n\n    $ tswift -l 'so casually cruel in the name of being honest'\n    Traceback (most recent call last):\n      File \"/usr/lib/python3/dist-packages/urllib3/connection.py\", line 169, in _new_conn\n        conn = connection.create_connection(\n      File \"/usr/lib/python3/dist-packages/urllib3/util/connection.py\", line 73, in create_connection\n        for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):\n      File \"/usr/lib/python3.9/socket.py\", line 953, in getaddrinfo\n        for res in _socket.getaddrinfo(host, port, family, type, proto, flags):\n    socket.gaierror: [Errno -5] No address associated with hostname\n\n    During handling of the above exception, another exception occurred:\n    .... many more tracebacks ....\n\nMaybe someday I'll select a new lyric website and try to implement a similar API\nfrom it. But it's unlikely it would be compatible (depends on the URL structure)\nand the content list (and formatting) would likely be different as well.\n\nRest in peace, Metrolyrics.\n\ntswift\n======\n\nThis repo is actually not directly related to Taylor Swift.  It's just a simple\nPython API for getting lyrics from MetroLyrics.  Here is how easy it is:\n\n.. code:: python\n\n    from tswift import Artist\n    import random\n\n    tswift = Artist('Taylor Swift')\n    song = random.choice(tswift.songs)\n    print(song.format())\n\nSetup\n-----\n\nThis package depends on ``lxml``, ``requests``, and ``google``. These should be\ninstalled when you install this package from pip:\n\n.. code::\n\n    pip install tswift\n\nAfter installing, you can also print a random Taylor Swift song lyric with the\ncommand:\n\n.. code::\n\n    tswift\n\nCLI\n---\n\nThe module comes with a simple command line interface. By default, it will\ndisplay a random song by Taylor Swift. You can specify an artist like this:\n\n.. code::\n\n    tswift 'Lynyrd Skynyrd'\n\nYou can choose a particular song:\n\n.. code::\n\n    tswift 'Lynyrd Skynyrd' -s Freebird\n\nThere is also a \"lyric search mode\", which allows you to search for a song by\nlyrics, e.g.:\n\n.. code::\n\n    tswift -l 'I would walk 500 miles'\n\n    Im Gonna Be 500 Miles\n    Proclaimers\n    ---------------------\n\n    When I wake up, well I know I'm gonna be,\n    I'm gonna be the man who wakes up next you\n    ...\n\nAPI\n---\n\nArtist class\n************\n\nThe constructor takes a single argument, the artist name. This name will be\n\"slugified\" in order to use it within URLs. This process involves replacing\nspaces with hyphens, and making everything lowercase. If this is not sufficient\nfor your particular artist, you'll need to provide a pre-slugified version of\ntheir name.\n\n- ``songs`` - a list of Song instances by this artist. This will call ``load()``\n  if it hasn't been called yet\n- ``name`` - the artist's slugified name\n- ``load()`` - populates the ``songs`` list\n\nSong class\n**********\n\nThe constructor can be called in two ways. In the first, you provide a\nMetrolyrics URL, and the class will infer the artist and song title:\n\n.. code:: python\n\n    s = Song(url='url here')\n\nIn the second way, you provide a title and artist, which will be slugified.\n\n.. code:: python\n\n    s = Song('Taylor Swift', 'Love Story')\n\nThe attributes are:\n\n- ``lyrics`` - a string. Accessing this will call ``load()`` if not yet loaded\n- ``title`` - de-slugified title of song\n- ``artist`` - de-slugified artist name\n- ``load()`` - loads the lyrics\n- ``format()`` - returns the lyrics, with a header that includes the title and\n  artist.\n\nThe static method ``Song.find_song(lyrics)`` takes a string with a search term,\nand performs a Google search. It returns a Song instance corresponding to the\nfirst Metrolyrics link it finds, stopping after 20 results. If nothing is found,\nreturns ``None``.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrenns10%2Ftswift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrenns10%2Ftswift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrenns10%2Ftswift/lists"}