From faa13839f898c60ff5618be6e916ad2e60958468 Mon Sep 17 00:00:00 2001 From: nil0j Date: Sat, 21 Sep 2024 10:17:23 +0200 Subject: init --- python/.gitignore | 1 + python/README.md | 5 + python/database.py | 20 ++ python/main.py | 10 + python/routes.py | 24 ++ rust/.gitignore | 4 + rust/Cargo.toml | 6 + rust/src/main.rs | 5 + rust/src/structs.rs | 35 ++ scrap/Lyrics_apathy.json | 863 +++++++++++++++++++++++++++++++++++++++++++++++ scrap/main.py | 18 + scrap/scrap.py | 25 ++ 12 files changed, 1016 insertions(+) create mode 100644 python/.gitignore create mode 100644 python/README.md create mode 100644 python/database.py create mode 100644 python/main.py create mode 100644 python/routes.py create mode 100644 rust/.gitignore create mode 100644 rust/Cargo.toml create mode 100644 rust/src/main.rs create mode 100644 rust/src/structs.rs create mode 100644 scrap/Lyrics_apathy.json create mode 100644 scrap/main.py create mode 100644 scrap/scrap.py diff --git a/python/.gitignore b/python/.gitignore new file mode 100644 index 0000000..c18dd8d --- /dev/null +++ b/python/.gitignore @@ -0,0 +1 @@ +__pycache__/ diff --git a/python/README.md b/python/README.md new file mode 100644 index 0000000..4a30035 --- /dev/null +++ b/python/README.md @@ -0,0 +1,5 @@ +[X] - Flask return json +[X] - Get parameters +[X] - Create database +[ ] - Interact with database +[ ] - diff --git a/python/database.py b/python/database.py new file mode 100644 index 0000000..5bc8b5f --- /dev/null +++ b/python/database.py @@ -0,0 +1,20 @@ +import mysql.connector + + +def getConnector(): + return mysql.connector.connect( + host="localhost", + user="root", + ) + + +def getCursor(connector): + return connector.cursor() + + +def runQuery(connector, query): + cursor = getCursor(connector) + cursor.execute(query) + result = cursor.fetchall() + cursor.close() + return result diff --git a/python/main.py b/python/main.py new file mode 100644 index 0000000..c778f8f --- /dev/null +++ b/python/main.py @@ -0,0 +1,10 @@ +import routes +import database + +connector = database.getConnector() +database.runQuery(connector, "SHOW DATABASES") + +app = routes.createApp() +routes.createRoutes(app, connector) + +app.run() diff --git a/python/routes.py b/python/routes.py new file mode 100644 index 0000000..a60584d --- /dev/null +++ b/python/routes.py @@ -0,0 +1,24 @@ +from flask import Flask, jsonify, request +import database + + +def createApp(): + return Flask(__name__) + + +def createRoutes(app, connector): + @app.route("/", methods=['GET']) + def hello_world(): + arg1 = request.args.get('arg1') + arg2 = request.args.get('arg2') + return jsonify({'arg1': arg1, + 'arg2': arg2}) + + @app.route("/db", methods=['GET']) + def database_hello(): + return jsonify( + database.runQuery( + connector, + "SHOW DATABASES" + ) + ) diff --git a/rust/.gitignore b/rust/.gitignore new file mode 100644 index 0000000..523b2b0 --- /dev/null +++ b/rust/.gitignore @@ -0,0 +1,4 @@ +lock/ +target/ +Cargo.lock +**/*.rs.bk diff --git a/rust/Cargo.toml b/rust/Cargo.toml new file mode 100644 index 0000000..f9fe11c --- /dev/null +++ b/rust/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "ver1" +version = "0.1.0" +edition = "2021" + +[dependencies] diff --git a/rust/src/main.rs b/rust/src/main.rs new file mode 100644 index 0000000..486aa6f --- /dev/null +++ b/rust/src/main.rs @@ -0,0 +1,5 @@ +mod structs; + +fn main() { + println!("Hello, world!"); +} diff --git a/rust/src/structs.rs b/rust/src/structs.rs new file mode 100644 index 0000000..7535bb4 --- /dev/null +++ b/rust/src/structs.rs @@ -0,0 +1,35 @@ +#[allow(dead_code)] +struct Song { + //song variables + id: i32, + title: String, + lyrics: String, + + //album variables + album_id: i32, + genres: Vec, + album_cover: String, + + //artist variables + artist_id: i32, + artist_name: String, +} + +#[allow(dead_code)] +struct Album { + id: i32, + title: String, + genres: Vec, + cover: String, + songs: Vec, +} + +#[allow(dead_code)] +struct Artist { + id: i32, + name: String, + genres: Vec, + albums: Vec, +} + +// lepht anonym diff --git a/scrap/Lyrics_apathy.json b/scrap/Lyrics_apathy.json new file mode 100644 index 0000000..0272d47 --- /dev/null +++ b/scrap/Lyrics_apathy.json @@ -0,0 +1,863 @@ +{ + "_type": "album", + "api_path": "/albums/774114", + "cover_art_thumbnail_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.300x300x1.jpg", + "cover_art_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.1000x1000x1.jpg", + "full_title": "apathy by Astrophysics", + "id": 774114, + "name": "apathy", + "name_with_artist": "apathy (artist: Astrophysics)", + "primary_artist_names": "Astrophysics", + "release_date_components": { + "year": 2020, + "month": 11, + "day": 20 + }, + "release_date_for_display": "November 20, 2020", + "url": "https://genius.com/albums/Astrophysics/Apathy", + "artist": { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + }, + "primary_artists": [ + { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + } + ], + "tracks": [ + { + "number": 1, + "song": { + "_type": "song", + "annotation_count": 0, + "api_path": "/songs/7516508", + "artist_names": "Astrophysics", + "full_title": "Oneironaut by\u00a0Astrophysics", + "header_image_thumbnail_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.300x300x1.jpg", + "header_image_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.1000x1000x1.jpg", + "id": 7516508, + "instrumental": true, + "lyrics_owner_id": 5253628, + "lyrics_state": "complete", + "lyrics_updated_at": 1674549360, + "path": "/Astrophysics-oneironaut-lyrics", + "primary_artist_names": "Astrophysics", + "pyongs_count": null, + "relationships_index_url": "https://genius.com/Astrophysics-oneironaut-sample", + "release_date_components": { + "year": 2020, + "month": 11, + "day": 6 + }, + "release_date_for_display": "November 6, 2020", + "release_date_with_abbreviated_month_for_display": "Nov. 6, 2020", + "song_art_image_thumbnail_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.300x300x1.jpg", + "song_art_image_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.1000x1000x1.jpg", + "stats": { + "unreviewed_annotations": 0, + "hot": false + }, + "title": "Oneironaut", + "title_with_featured": "Oneironaut", + "updated_by_human_at": 1674549387, + "url": "https://genius.com/Astrophysics-oneironaut-lyrics", + "featured_artists": [], + "primary_artist": { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + }, + "primary_artists": [ + { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + } + ], + "artist": "Astrophysics", + "lyrics": "" + } + }, + { + "number": 2, + "song": { + "_type": "song", + "annotation_count": 0, + "api_path": "/songs/7516509", + "artist_names": "Astrophysics", + "full_title": "How to dance your pain away by\u00a0Astrophysics", + "header_image_thumbnail_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.300x300x1.jpg", + "header_image_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.1000x1000x1.jpg", + "id": 7516509, + "instrumental": true, + "lyrics_owner_id": 5253628, + "lyrics_state": "complete", + "lyrics_updated_at": 1674549450, + "path": "/Astrophysics-how-to-dance-your-pain-away-lyrics", + "primary_artist_names": "Astrophysics", + "pyongs_count": null, + "relationships_index_url": "https://genius.com/Astrophysics-how-to-dance-your-pain-away-sample", + "release_date_components": { + "year": 2020, + "month": 11, + "day": 6 + }, + "release_date_for_display": "November 6, 2020", + "release_date_with_abbreviated_month_for_display": "Nov. 6, 2020", + "song_art_image_thumbnail_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.300x300x1.jpg", + "song_art_image_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.1000x1000x1.jpg", + "stats": { + "unreviewed_annotations": 0, + "hot": false + }, + "title": "How to dance your pain away", + "title_with_featured": "How to dance your pain away", + "updated_by_human_at": 1674549467, + "url": "https://genius.com/Astrophysics-how-to-dance-your-pain-away-lyrics", + "featured_artists": [], + "primary_artist": { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + }, + "primary_artists": [ + { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + } + ], + "artist": "Astrophysics", + "lyrics": "" + } + }, + { + "number": 3, + "song": { + "_type": "song", + "annotation_count": 1, + "api_path": "/songs/6169951", + "artist_names": "Astrophysics (Ft. MINTTT)", + "full_title": "Soft Goth by\u00a0Astrophysics (Ft.\u00a0MINTTT)", + "header_image_thumbnail_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.300x300x1.jpg", + "header_image_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.1000x1000x1.jpg", + "id": 6169951, + "instrumental": false, + "lyrics_owner_id": 12077622, + "lyrics_state": "complete", + "lyrics_updated_at": 1698884040, + "path": "/Astrophysics-soft-goth-lyrics", + "primary_artist_names": "Astrophysics", + "pyongs_count": null, + "relationships_index_url": "https://genius.com/Astrophysics-soft-goth-sample", + "release_date_components": { + "year": 2020, + "month": 11, + "day": 20 + }, + "release_date_for_display": "November 20, 2020", + "release_date_with_abbreviated_month_for_display": "Nov. 20, 2020", + "song_art_image_thumbnail_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.300x300x1.jpg", + "song_art_image_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.1000x1000x1.jpg", + "stats": { + "unreviewed_annotations": 1, + "hot": false + }, + "title": "Soft Goth", + "title_with_featured": "Soft Goth (Ft.\u00a0MINTTT)", + "updated_by_human_at": 1698884040, + "url": "https://genius.com/Astrophysics-soft-goth-lyrics", + "featured_artists": [ + { + "_type": "artist", + "api_path": "/artists/2398321", + "header_image_url": "https://images.genius.com/0ee18f73177652e2be886e7a33584738.1000x1000x1.png", + "id": 2398321, + "image_url": "https://images.genius.com/af356e1b18390247a4fe35e2c3feecfd.1000x1000x1.png", + "index_character": "m", + "is_meme_verified": false, + "is_verified": false, + "name": "MINTTT", + "slug": "Minttt", + "url": "https://genius.com/artists/Minttt" + } + ], + "primary_artist": { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + }, + "primary_artists": [ + { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + } + ], + "artist": "Astrophysics", + "lyrics": "6 ContributorsSoft Goth Lyrics[Verse 1]\nWhat is that one thing that drives you?\nWhat is that one thing that makes you shine?\nYou can't make this up (x5)\n(You can't make this up) (x5)\n\n[Bridge]\nThe best you can, is not enough\nThe best you can, is not enough\n\n[Chorus 1]\nThis one is pessimistic\nThis one is pessimistic\nThis one is pessimistic\nThis one is pessimistic\n\n[Verse 2]\nYou wanna live a life you never had\nYou're gonna fake a laugh and lie your way ahead\nYou're saying pretty words to hide your face\nYour broken notion only leads to vicious ways\n\n[Chorus 2]\nThis one is pessimistic\nThis one is pessimistic\nThis one is pessimistic\nThis one is pessimistic\nYou might also likeThis one is pessimistic (Not enough)\nThis one is pessimistic\nThis one is pessimistic (Not enough)\nThis one is pessimistic\n\n[Verse 3]\n(The best you can is not enough\nWhat did you expect from it?\nWill you ever shine again? By yourself? All alone?\nSome things are not meant to be\nUnderstand, go home\nAll alone)\n\n[Bridge]\nYou're gonna share your sad stories with your friends\nYou wanna think somebody one day ever cared\n\n[Chorus 3]\n\"Hold me\", \"Hold me\", you say it, alone\nAlone, alone, you were always alone\nAlone, alone, you were always alone\nAlone, alone, you were always alone\n\"Hold me\", \"Hold me\", you say it, alone\nAlone, alone, you were always alone\nAlone, alone, you were always alone\nAlone, alone, you were always alone\n[Outro]\nAlone...Embed" + } + }, + { + "number": 4, + "song": { + "_type": "song", + "annotation_count": 0, + "api_path": "/songs/6861432", + "artist_names": "Astrophysics", + "full_title": "Narcotics by\u00a0Astrophysics", + "header_image_thumbnail_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.300x300x1.jpg", + "header_image_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.1000x1000x1.jpg", + "id": 6861432, + "instrumental": false, + "lyrics_owner_id": 13724625, + "lyrics_state": "complete", + "lyrics_updated_at": 1683589886, + "path": "/Astrophysics-narcotics-lyrics", + "primary_artist_names": "Astrophysics", + "pyongs_count": null, + "relationships_index_url": "https://genius.com/Astrophysics-narcotics-sample", + "release_date_components": { + "year": 2020, + "month": 11, + "day": 6 + }, + "release_date_for_display": "November 6, 2020", + "release_date_with_abbreviated_month_for_display": "Nov. 6, 2020", + "song_art_image_thumbnail_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.300x300x1.jpg", + "song_art_image_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.1000x1000x1.jpg", + "stats": { + "unreviewed_annotations": 0, + "hot": false + }, + "title": "Narcotics", + "title_with_featured": "Narcotics", + "updated_by_human_at": 1683589886, + "url": "https://genius.com/Astrophysics-narcotics-lyrics", + "featured_artists": [], + "primary_artist": { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + }, + "primary_artists": [ + { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + } + ], + "artist": "Astrophysics", + "lyrics": "2 ContributorsNarcotics LyricsNarcotic nights\nAre not so different\nOne day you feel great\nNext day you might die\nNarcotic nights\nNow you will ignite me\nRussian roulette with my life\nIn the lowest of my heights\n\nTake a deep breath\nEverything will set it\n'now I think it's time to leave\n\nLeave em right now\nLeave em right now\nJust leave\nLeave em right now\nLeave em right now\n\n\nPretend you got a life to live\n\nPretend you got a life to live\nPretend you have your best to give\nPretend you have a mouth to feed\nPretend you're not a lie\nYou might also likeA lie\n\nTake a deep breath\nHigher thoughts will drown in\nAll you have to do is leave\n\nLeave em out right\nJust leave\nTo live a life of lies\nYou make everynight\n\nA lie\n\nYou will burn in hell for that\nBurn in hell for that\nBurn in hell\n\nBurn it\n\nNarcotic nights are all so similar\nThey take away your yearn to live until we take off\nNumb for something\nFool me for a dreamEmbed" + } + }, + { + "number": 5, + "song": { + "_type": "song", + "annotation_count": 1, + "api_path": "/songs/5967102", + "artist_names": "Astrophysics (Ft. MINTTT)", + "full_title": "Fishnets by\u00a0Astrophysics (Ft.\u00a0MINTTT)", + "header_image_thumbnail_url": "https://images.genius.com/b7010e41dfdf9f0b50116fbf5dc2f09c.300x300x1.jpg", + "header_image_url": "https://images.genius.com/b7010e41dfdf9f0b50116fbf5dc2f09c.1000x1000x1.jpg", + "id": 5967102, + "instrumental": false, + "lyrics_owner_id": 7156123, + "lyrics_state": "complete", + "lyrics_updated_at": 1725916437, + "path": "/Astrophysics-fishnets-lyrics", + "primary_artist_names": "Astrophysics", + "pyongs_count": null, + "relationships_index_url": "https://genius.com/Astrophysics-fishnets-sample", + "release_date_components": { + "year": 2020, + "month": 9, + "day": 4 + }, + "release_date_for_display": "September 4, 2020", + "release_date_with_abbreviated_month_for_display": "Sep. 4, 2020", + "song_art_image_thumbnail_url": "https://images.genius.com/b7010e41dfdf9f0b50116fbf5dc2f09c.300x300x1.jpg", + "song_art_image_url": "https://images.genius.com/b7010e41dfdf9f0b50116fbf5dc2f09c.1000x1000x1.jpg", + "stats": { + "unreviewed_annotations": 1, + "hot": false + }, + "title": "Fishnets", + "title_with_featured": "Fishnets (Ft.\u00a0MINTTT)", + "updated_by_human_at": 1725916437, + "url": "https://genius.com/Astrophysics-fishnets-lyrics", + "featured_artists": [ + { + "_type": "artist", + "api_path": "/artists/2398321", + "header_image_url": "https://images.genius.com/0ee18f73177652e2be886e7a33584738.1000x1000x1.png", + "id": 2398321, + "image_url": "https://images.genius.com/af356e1b18390247a4fe35e2c3feecfd.1000x1000x1.png", + "index_character": "m", + "is_meme_verified": false, + "is_verified": false, + "name": "MINTTT", + "slug": "Minttt", + "url": "https://genius.com/artists/Minttt" + } + ], + "primary_artist": { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + }, + "primary_artists": [ + { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + } + ], + "artist": "Astrophysics", + "lyrics": "4 ContributorsFishnets LyricsThis is the end of me\nThis is the end of history\nI'll find another place to be\nFishnets, makeup, lipstick\nBlack flag, music, citizenship\nI'm up to anything\n\nI'll put myself in orbit\nTo be the red star that will shine\nForever upon those who dare to try\n\nDreamless state of apathy\nI'll bring a long gone taste of ecstasy\nFor you to remember what you're fighting for\n\nThis is the end of me\nThis is the end of me\n\n\nThis is the end for me\nThis is the end of our misery\nI'll found myself a way to live\nMovement, street and action\nMovies, youth and affection\nI'm up to anything\nFishnets, makeup, lipstick\nRed flag, riot and unity\nI'm playing with everything\nYou might also likeI'll put myself in orbit\nTo be the red star that will shine\nForever upon those who dare to try\n\nDreamless state of apathy\nI'll bring a long gone taste of ecstasy\nFor you to remember what you're fighting for\n\nI'll put myself in orbit\nTo be the hope of a better life\nFor the poor souls deceived by lies\n\nUrgent need of epiphany\nI'll bring an immortal dose of my medicine\nFor you to be able to stand on your feet\n\nThis is the end of me (3x)Embed" + } + }, + { + "number": 6, + "song": { + "_type": "song", + "annotation_count": 0, + "api_path": "/songs/6861442", + "artist_names": "Astrophysics (Ft. MINTTT)", + "full_title": "Traumacore by\u00a0Astrophysics (Ft.\u00a0MINTTT)", + "header_image_thumbnail_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.300x300x1.jpg", + "header_image_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.1000x1000x1.jpg", + "id": 6861442, + "instrumental": false, + "lyrics_owner_id": 13724625, + "lyrics_state": "complete", + "lyrics_updated_at": 1622318487, + "path": "/Astrophysics-traumacore-lyrics", + "primary_artist_names": "Astrophysics", + "pyongs_count": null, + "relationships_index_url": "https://genius.com/Astrophysics-traumacore-sample", + "release_date_components": { + "year": 2020, + "month": 11, + "day": 6 + }, + "release_date_for_display": "November 6, 2020", + "release_date_with_abbreviated_month_for_display": "Nov. 6, 2020", + "song_art_image_thumbnail_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.300x300x1.jpg", + "song_art_image_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.1000x1000x1.jpg", + "stats": { + "unreviewed_annotations": 0, + "hot": false + }, + "title": "Traumacore", + "title_with_featured": "Traumacore (Ft.\u00a0MINTTT)", + "updated_by_human_at": 1622318588, + "url": "https://genius.com/Astrophysics-traumacore-lyrics", + "featured_artists": [ + { + "_type": "artist", + "api_path": "/artists/2398321", + "header_image_url": "https://images.genius.com/0ee18f73177652e2be886e7a33584738.1000x1000x1.png", + "id": 2398321, + "image_url": "https://images.genius.com/af356e1b18390247a4fe35e2c3feecfd.1000x1000x1.png", + "index_character": "m", + "is_meme_verified": false, + "is_verified": false, + "name": "MINTTT", + "slug": "Minttt", + "url": "https://genius.com/artists/Minttt" + } + ], + "primary_artist": { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + }, + "primary_artists": [ + { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + } + ], + "artist": "Astrophysics", + "lyrics": "2 ContributorsTraumacore LyricsIron scent along with gas in veins\nI'll be the one to drown\nI'll be the one to choke\nReach the key while you still believe\nI'll be the one to feel your painful lie\n\nYour scars will bring me to tears\nFor nothing will ever be the same again\nTake my name\nAnd cry until the end of time\n\n(I'm floating forever)\n\nMark my world\nFor me to go away\nLike I'm going down\nLike I'm fading out\n\nSee through me\nWhile I'm crystal clear\nI'm going up\nJust floating out of reach\n\n(I'm floating forev\u0435r)\n\nYour scars will bring me to tears\nFor nothing will ev\u0435r be the same again\nTake my name\nAnd cry, cry, cryYou might also likeEmbed" + } + }, + { + "number": 7, + "song": { + "_type": "song", + "annotation_count": 0, + "api_path": "/songs/6859114", + "artist_names": "Astrophysics (Ft. MINTTT)", + "full_title": "Dark Circles by\u00a0Astrophysics (Ft.\u00a0MINTTT)", + "header_image_thumbnail_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.300x300x1.jpg", + "header_image_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.1000x1000x1.jpg", + "id": 6859114, + "instrumental": false, + "lyrics_owner_id": 13724625, + "lyrics_state": "complete", + "lyrics_updated_at": 1622249838, + "path": "/Astrophysics-dark-circles-lyrics", + "primary_artist_names": "Astrophysics", + "pyongs_count": null, + "relationships_index_url": "https://genius.com/Astrophysics-dark-circles-sample", + "release_date_components": { + "year": 2020, + "month": 11, + "day": 6 + }, + "release_date_for_display": "November 6, 2020", + "release_date_with_abbreviated_month_for_display": "Nov. 6, 2020", + "song_art_image_thumbnail_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.300x300x1.jpg", + "song_art_image_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.1000x1000x1.jpg", + "stats": { + "unreviewed_annotations": 0, + "hot": false + }, + "title": "Dark Circles", + "title_with_featured": "Dark Circles (Ft.\u00a0MINTTT)", + "updated_by_human_at": 1622400627, + "url": "https://genius.com/Astrophysics-dark-circles-lyrics", + "featured_artists": [ + { + "_type": "artist", + "api_path": "/artists/2398321", + "header_image_url": "https://images.genius.com/0ee18f73177652e2be886e7a33584738.1000x1000x1.png", + "id": 2398321, + "image_url": "https://images.genius.com/af356e1b18390247a4fe35e2c3feecfd.1000x1000x1.png", + "index_character": "m", + "is_meme_verified": false, + "is_verified": false, + "name": "MINTTT", + "slug": "Minttt", + "url": "https://genius.com/artists/Minttt" + } + ], + "primary_artist": { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + }, + "primary_artists": [ + { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + } + ], + "artist": "Astrophysics", + "lyrics": "2 ContributorsDark Circles LyricsAre you afraid of closing your eyes?\nWhen it's pitch black, what do you find?\nI'm playing\u2005dead\u2005all night\n\nMind is\u2005too weak, future is bleak\nWhen the\u2005sun out where do you hide?\nI'm freaking out right now\n\nI'm losing it all tonight\nAbusing myself full time\n\nMy emergency test\nI'm not yet prepared\nTo face a life\nAnd face regret\n\nTo see in the dark\nIs the hardest part\nMy new pastime\nWith closed eyes\n\nWith closed eyes\n\nAre you afraid of closing your eyes?\nAfraid you have more dreamless nights?\nAfraid you have more\nAnd don't sleep anymore?\nYou might also likeI don't sleep anymoreEmbed" + } + }, + { + "number": 8, + "song": { + "_type": "song", + "annotation_count": 0, + "api_path": "/songs/6861470", + "artist_names": "Astrophysics", + "full_title": "Manifesto by\u00a0Astrophysics", + "header_image_thumbnail_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.300x300x1.jpg", + "header_image_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.1000x1000x1.jpg", + "id": 6861470, + "instrumental": false, + "lyrics_owner_id": 13724625, + "lyrics_state": "complete", + "lyrics_updated_at": 1622318791, + "path": "/Astrophysics-manifesto-lyrics", + "primary_artist_names": "Astrophysics", + "pyongs_count": null, + "relationships_index_url": "https://genius.com/Astrophysics-manifesto-sample", + "release_date_components": { + "year": 2020, + "month": 11, + "day": 6 + }, + "release_date_for_display": "November 6, 2020", + "release_date_with_abbreviated_month_for_display": "Nov. 6, 2020", + "song_art_image_thumbnail_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.300x300x1.jpg", + "song_art_image_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.1000x1000x1.jpg", + "stats": { + "unreviewed_annotations": 0, + "hot": false + }, + "title": "Manifesto", + "title_with_featured": "Manifesto", + "updated_by_human_at": 1622318833, + "url": "https://genius.com/Astrophysics-manifesto-lyrics", + "featured_artists": [], + "primary_artist": { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + }, + "primary_artists": [ + { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + } + ], + "artist": "Astrophysics", + "lyrics": "2 ContributorsManifesto LyricsThe fading light is just perfect\nTo blur the shadows on this room\nAnd easy the aching fatigue\nOn uneventful eyes\n\nPlease\nJust wait for me\nPlease\nJust wait for me\n\nAnd who you are?\nSomeone too far\nAnd who you are?\nSomeone, nothing\n\nScattered routines\nSimple addictions\nAnger is the key\nSweet solitude\nPush everyone away from me\n\nScattered routines\nSimple addictions\nAnger is the key\nSweet solitud\u0435\nPush everyone away from m\u0435\nYou might also likePlease just wait for me\nPlease just wait for me\nSomeone?\nAnyone?\n\nScattered routines\nSimple addictions\nAnger is the key\nSweet solitude\nPush everyone away from me\n\nScattered routines\nSimple addictions\nAnger is the key\nSweet solitude\nPush everyone away from meEmbed" + } + }, + { + "number": 9, + "song": { + "_type": "song", + "annotation_count": 0, + "api_path": "/songs/7516510", + "artist_names": "Astrophysics", + "full_title": "Shine by\u00a0Astrophysics", + "header_image_thumbnail_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.300x300x1.jpg", + "header_image_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.1000x1000x1.jpg", + "id": 7516510, + "instrumental": true, + "lyrics_owner_id": 5253628, + "lyrics_state": "complete", + "lyrics_updated_at": 1674549488, + "path": "/Astrophysics-shine-lyrics", + "primary_artist_names": "Astrophysics", + "pyongs_count": null, + "relationships_index_url": "https://genius.com/Astrophysics-shine-sample", + "release_date_components": { + "year": 2020, + "month": 11, + "day": 6 + }, + "release_date_for_display": "November 6, 2020", + "release_date_with_abbreviated_month_for_display": "Nov. 6, 2020", + "song_art_image_thumbnail_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.300x300x1.jpg", + "song_art_image_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.1000x1000x1.jpg", + "stats": { + "unreviewed_annotations": 0, + "hot": false + }, + "title": "Shine", + "title_with_featured": "Shine", + "updated_by_human_at": 1674549501, + "url": "https://genius.com/Astrophysics-shine-lyrics", + "featured_artists": [], + "primary_artist": { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + }, + "primary_artists": [ + { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + } + ], + "artist": "Astrophysics", + "lyrics": "" + } + }, + { + "number": 10, + "song": { + "_type": "song", + "annotation_count": 0, + "api_path": "/songs/7516511", + "artist_names": "Astrophysics", + "full_title": "Losing track of time by\u00a0Astrophysics", + "header_image_thumbnail_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.300x300x1.jpg", + "header_image_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.1000x1000x1.jpg", + "id": 7516511, + "instrumental": true, + "lyrics_owner_id": 5253628, + "lyrics_state": "complete", + "lyrics_updated_at": 1674549515, + "path": "/Astrophysics-losing-track-of-time-lyrics", + "primary_artist_names": "Astrophysics", + "pyongs_count": null, + "relationships_index_url": "https://genius.com/Astrophysics-losing-track-of-time-sample", + "release_date_components": { + "year": 2020, + "month": 11, + "day": 6 + }, + "release_date_for_display": "November 6, 2020", + "release_date_with_abbreviated_month_for_display": "Nov. 6, 2020", + "song_art_image_thumbnail_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.300x300x1.jpg", + "song_art_image_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.1000x1000x1.jpg", + "stats": { + "unreviewed_annotations": 0, + "hot": false + }, + "title": "Losing track of time", + "title_with_featured": "Losing track of time", + "updated_by_human_at": 1674549531, + "url": "https://genius.com/Astrophysics-losing-track-of-time-lyrics", + "featured_artists": [], + "primary_artist": { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + }, + "primary_artists": [ + { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + } + ], + "artist": "Astrophysics", + "lyrics": "" + } + }, + { + "number": 11, + "song": { + "_type": "song", + "annotation_count": 0, + "api_path": "/songs/6861486", + "artist_names": "Astrophysics", + "full_title": "Apathy by\u00a0Astrophysics", + "header_image_thumbnail_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.300x300x1.jpg", + "header_image_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.1000x1000x1.jpg", + "id": 6861486, + "instrumental": false, + "lyrics_owner_id": 13724625, + "lyrics_state": "complete", + "lyrics_updated_at": 1622318925, + "path": "/Astrophysics-apathy-lyrics", + "primary_artist_names": "Astrophysics", + "pyongs_count": null, + "relationships_index_url": "https://genius.com/Astrophysics-apathy-sample", + "release_date_components": { + "year": 2020, + "month": 11, + "day": 6 + }, + "release_date_for_display": "November 6, 2020", + "release_date_with_abbreviated_month_for_display": "Nov. 6, 2020", + "song_art_image_thumbnail_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.300x300x1.jpg", + "song_art_image_url": "https://images.genius.com/2a1043511e95ccb127b621cb5f9cae1f.1000x1000x1.jpg", + "stats": { + "unreviewed_annotations": 0, + "hot": false + }, + "title": "Apathy", + "title_with_featured": "Apathy", + "updated_by_human_at": 1622318961, + "url": "https://genius.com/Astrophysics-apathy-lyrics", + "featured_artists": [], + "primary_artist": { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + }, + "primary_artists": [ + { + "_type": "artist", + "api_path": "/artists/2398496", + "header_image_url": "https://images.genius.com/8d8227c9c358099f6703d7ad41904188.975x180x1.png", + "id": 2398496, + "image_url": "https://images.genius.com/db76efe4fc336a7cb0b25463d11ddec0.400x400x1.jpg", + "index_character": "a", + "is_meme_verified": false, + "is_verified": false, + "name": "Astrophysics", + "slug": "Astrophysics", + "url": "https://genius.com/artists/Astrophysics" + } + ], + "artist": "Astrophysics", + "lyrics": "2 ContributorsApathy LyricsEmbrace me as we take off\nWe'll be introduce to war\nNo more confort\nNo more\n\nNo more expectations\nNo more joy\nNo more kindness\nNo more love\n\nNo more\n\nNo more expectations\nNo more joy\nNo more kindness\nNo moreYou might also likeEmbed" + } + } + ] +} diff --git a/scrap/main.py b/scrap/main.py new file mode 100644 index 0000000..80f4d24 --- /dev/null +++ b/scrap/main.py @@ -0,0 +1,18 @@ +import lyricsgenius +import sys + + +def getAlbum(artist_name, album_name): + genius = lyricsgenius.Genius( + "0uSA9UFGsiO2WozVmbWPhyhOoVmUNuM3PXRt9rvWhptHBMgSO5CZBxGUMkwet5mv" + ) + album = genius.search_album(artist_name, album_name) + album.save_lyrics() + + +def getJsonLyrics(link): + for key, value in data.items(): + print(key, value) + + +getJsonLyrics(sys.argv[1]) diff --git a/scrap/scrap.py b/scrap/scrap.py new file mode 100644 index 0000000..d979f49 --- /dev/null +++ b/scrap/scrap.py @@ -0,0 +1,25 @@ +from bs4 import BeautifulSoup +import re +# import os +import sys +import requests + + +def scrape_song_lyrics(url): + page = requests.get(url) + html = BeautifulSoup(page.text, 'html.parser') + lyrics = str(html.find( + 'div', + # class_='lyrics-root-pin-spacer', + class_='Lyrics__Container-sc-1ynbvzw-1 kUgSbL' + )) + # remove identifiers like chorus, verse, etc + lyrics = re.sub(r'[\(\[].*?[\)\]]', '', lyrics) + lyrics = re.sub(r'<.*?>', '\n', lyrics) + # remove empty lines + # lyrics = os.linesep.join([s for s in lyrics.splitlines() if s]) + lyrics = "\n".join([s for s in lyrics.split("\n") if s]) + return lyrics + + +print(scrape_song_lyrics(sys.argv[1])) -- cgit v1.2.3