(request: WSGIRequest)
return HttpResponse(message)
This endpoint is part of the API and exempt from CSRF checks.
    Shareberry uses this endpoint.
This endpoint is part of the API and exempt from CSRF checks.
    Shareberry uses this endpoint.
This endpoint is part of the API and exempt from CSRF checks . Shareberry uses this endpoint .
def post_song(request: WSGIRequest) -> HttpResponse:
    """This endpoint is part of the API and exempt from CSRF checks.
    Shareberry uses this endpoint."""
    # only get ip on user requests
    query = request.POST.get("query")
    if not query:
        return HttpResponseBadRequest("No query to share.")

    match = re.search(r"(?P<url>https?://[^\s]+)", query)
    if match:
        query = match.group("url")

    # Set the requested platform to 'spotify'.
    # It will automatically fall back to Youtube
    # if Spotify is not enabled or a youtube link was requested.
    successful, message, _ = musiq.do_request_music(
        request.session.session_key, query, None, False, "spotify"
    )
    if not successful:
        return HttpResponseBadRequest(message)
    return HttpResponse(message)
def post_song ( request : WSGIRequest ) -> HttpResponse : # only get ip on user requests query = request . POST . get ( "query" ) if not query : return HttpResponseBadRequest ( "No query to share." ) match = re . search ( r"(?P<url>https?://[^\s]+)" , query ) if match : query = match . group ( "url" ) # Set the requested platform to 'spotify'. # It will automatically fall back to Youtube # if Spotify is not enabled or a youtube link was requested. successful , message , _ = musiq . do_request_music ( request . session . session_key , query , None , False , "spotify" ) if not successful : return HttpResponseBadRequest ( message ) return HttpResponse ( message )