
외롭고 지루한 SWE들을 위한 Hinge 데이트 앱 Python SDK
Hinge API용 비공식 Python SDK. 프로그래밍 방식으로 Hinge와 상호작용하여 추천 가져오기, 메시지 보내기, 미디어 다운로드, 상호작용 자동화를 수행합니다.
SDK를 사용하려면 유효한 인증 자격 증명이 필요합니다. 이러한 자격 증명은 .env 파일에 저장하거나 클라이언트에 직접 전달할 수 있습니다.
BEARER_TOKEN: JWT 인증 토큰 (예: L2euNWN...).SESSION_ID: 현재 세션 UUID.USER_ID: 고유한 사용자/플레이어 ID.기존 Hinge 계정을 사용하면서 새 기기 로그인으로 인한 플래그를 피하려면 앱 네트워크 트래픽에서 이러한 값을 추출해야 합니다.
참고: 올바른 변수를 얻기 위해 이 작업은 한 번만 수행하면 됩니다. 캡처 후에는 향후 세션에 SMS 로그인 방법을 사용할 수 있습니다.
prod-api.hingeaws.net 또는 유사한 Hinge 엔드포인트에 대한 HTTPS 요청을 검사하세요.authorization (Bearer 토큰)x-session-idx-device-idx-install-idUser ID (응답 본문에 subjectId 등으로 포함됨)SDK를 통해 SMS로 로그인하여 새 자격 증명을 생성할 수 있습니다. 이는 새 로그인 흐름을 수행합니다.
from hingesdk.client import HingeClient
# These IDs must match the actual values associated with your account.
# You cannot use random UUIDs; they must align with the account's registered device.
client = HingeClient.login_with_sms(
phone_number="+15551234567",
device_id="your_device_id_uuid",
install_id="your_install_id_uuid"
)
print(f"BEARER_TOKEN={client.auth_token}")
print(f"SESSION_ID={client.session_id}")
print(f"USER_ID={client.user_id}")
리포지토리를 클론하고 패키지를 설치합니다:
git clone https://github.com/reedgraff/hingesdk
cd hingesdk
pip install .
인증하고 사용자 추천을 가져오는 최소한의 예제입니다.
import os
from hingesdk.api import HingeAPIClient
# Initialize with credentials
client = HingeAPIClient(
auth_token=os.getenv("BEARER_TOKEN"),
session_id=os.getenv("SESSION_ID"),
user_id=os.getenv("USER_ID")
)
# Fetch recommendations
recs = client.get_recommendations()
print(f"Successfully fetched recommendations request.")
from hingesdk.client import HingeAPIClient
auth_token = 'your_auth_token'
user_id = 'your_user_id'
client = HingeAPIClient(auth_token=auth_token, user_id=user_id)
response = client.send_message(
subject_id='receiver_id',
message='Hello, this is a test message!'
)
print(response)
from hingesdk.api import HingeAPIClient
client = HingeAPIClient(auth_token=auth_token, user_id=user_id)
recommendations = client.get_recommendations()
print(recommendations)
from hingesdk.tools import HingeTools
from hingesdk.api import HingeAPIClient
from hingesdk.media import HingeMediaClient
api_client = HingeAPIClient(auth_token=auth_token, user_id=user_id)
media_client = HingeMediaClient(auth_token=auth_token)
tools = HingeTools(api_client, media_client)
tools.download_recommendation_content(output_path='path_to_save_images')
import os
import json
from hingesdk.tools import HingeTools
from hingesdk.api import HingeAPIClient
from hingesdk.media import HingeMediaClient
auth_token = os.getenv("BEARER_TOKEN")
session_id = os.getenv("SESSION_ID")
user_id = os.getenv("USER_ID")
api_client = HingeAPIClient(
auth_token=auth_token,
session_id=session_id,
user_id=user_id
)
media_client = HingeMediaClient(auth_token=auth_token)
tools = HingeTools(api_client, media_client)
# Example: Get user info
tools.create_profile_json(
source=ProfileSource.STANDOUTS,
output_file="standouts.json"
)
# Example: Like a user
with open("standouts.json", "r") as f:
profiles = json.load(f)
personData = profiles["35582109789..."]
# Like a user's question
questionIDToLike = "5c4a346828fd883a24..."
response = api_client.like_profile(
subject_id=personData["interaction_data"]["subject_id"],
rating_token=personData["interaction_data"]["rating_token"],
prompt={
"questionId": questionIDToLike,
"response": "I've been in Miami for a year and still haven't gone (╥﹏╥)"
}
)
print(response)
# Like a user's photo
# photoIDToLike = "2c6411ac-66e4-4194-..."
# response = api_client.like_profile(
# subject_id=personData["interaction_data"]["subject_id"],
# rating_token=personData["interaction_data"]["rating_token"],
# photo={
# "contentId": photoIDToLike,
# "comment": "So how many people have commented saying they've been here before?"
# }
# )
# print(response)
이 예시는 추천을 스크랩하고 특정 기준(예: 상위 대학)에 따라 프로필을 필터링하는 방법을 보여줍니다.