diff --git a/maigret/activation.py b/maigret/activation.py index e4cb66b..af2b542 100644 --- a/maigret/activation.py +++ b/maigret/activation.py @@ -27,6 +27,15 @@ class ParsingActivator: jwt_token = r.json()['jwt'] site.headers['Authorization'] = 'jwt ' + jwt_token + @staticmethod + def spotify(site, logger, cookies={}): + headers = dict(site.headers) + if 'Authorization' in headers: + del headers['Authorization'] + r = requests.get(site.activation['url']) + bearer_token = r.json()['accessToken'] + site.headers['authorization'] = f'Bearer {bearer_token}' + @staticmethod def xssis(site, logger, cookies={}): if not cookies: diff --git a/maigret/checking.py b/maigret/checking.py index 1f1b9c2..c47d710 100644 --- a/maigret/checking.py +++ b/maigret/checking.py @@ -20,6 +20,7 @@ supported_recursive_search_ids = ( 'vk_id', 'ok_id', 'wikimapia_uid', + 'steam_id', ) common_errors = { @@ -332,6 +333,7 @@ async def maigret(username, site_dict, query_notify, logger, cookie_jar = None if cookies: + logger.debug(f'Using cookies jar file {cookies}') cookie_jar = await import_aiohttp_cookies(cookies) session = aiohttp.ClientSession(connector=connector, trust_env=True, cookie_jar=cookie_jar) diff --git a/maigret/maigret.py b/maigret/maigret.py index e304d5e..fcef4af 100755 --- a/maigret/maigret.py +++ b/maigret/maigret.py @@ -67,7 +67,7 @@ async def main(): action="store", metavar='TIMEOUT', dest="timeout", type=timeout_check, default=10, help="Time (in seconds) to wait for response to requests." - "Default timeout of 10.0s." + "Default timeout of 10.0s. " "A longer timeout will be more likely to get results from slow sites." "On the other hand, this may cause a long delay to gather all results." ) diff --git a/maigret/resources/data.json b/maigret/resources/data.json index 30cd298..d4b28d9 100644 --- a/maigret/resources/data.json +++ b/maigret/resources/data.json @@ -12228,9 +12228,23 @@ "tags": [ "music" ], + "headers": { + "authorization": "Bearer BQAlrJSKV_X_SgmGTiRWa2Q7FDLUFK6PiNNMhrdbhl0OccgNhCajMTaSPJuw18sckyjbw4j1nCYN-GmFBBs" + }, "errors": { "Spotify is currently not available in your country.": "Access denied in your country, use proxy/vpn" }, + "activation": { + "method": "spotify", + "marks": [ + "No token provided", + "The access token expired" + ], + "url": "https://open.spotify.com/get_access_token?reason=transport&productType=web_player", + "src": "accessToken", + "dst": "authorization" + }, + "urlProbe": "https://spclient.wg.spotify.com/user-profile-view/v3/profile/{username}?playlist_limit=10&artist_limit=10&market=EN", "checkType": "status_code", "alexaRank": 81, "url": "https://open.spotify.com/user/{username}", @@ -12311,7 +12325,8 @@ }, "Steam": { "tags": [ - "gaming" + "gaming", + "steam" ], "checkType": "message", "absenceStrs": "The specified profile could not be found", @@ -12323,7 +12338,8 @@ }, "SteamGroup": { "tags": [ - "us" + "us", + "steam" ], "checkType": "message", "absenceStrs": "No group could be retrieved for the given URL", @@ -12334,11 +12350,9 @@ "usernameUnclaimed": "noonewouldeverusethis7" }, "Steamid": { - "disabled": true, "tags": [ - "ru", - "tr", - "us" + "gaming", + "steam" ], "checkType": "message", "absenceStrs": "