2 글 보임 - 1 에서 2 까지 (총 2 중에서)
-
글쓴이글
-
2025년 10월 12일 10:45 #142799

오주혁참가자aiohttp 사이트 요청이 많아 차단된 경우어떻게 해야 될까요 제 PC에서 브라우저로 그 사이트에 캐쉬 삭제하니까 잘 작동하긴 해서 aiohttp도 캐쉬 삭제하게 해놨는데 여전히 막힙니다 "error":444,"message":"[285] 비정상적인 요청입니다.", "result":{"error":444}} {error: 444, message: "[128] 요청이 거부되었습니다."}async def submit_momopin(interaction, gift_type, bank_code, account, holder, gift_number): import json, aiohttp, asyncio import nextcordCATEGORY_ID = 1425718672051142687 # 🔹 무인 환전 카테고리 ID REVIEW_CHANNEL_ID = 1426480819660263494 # 🔹 리뷰 전송 채널 IDgift_map = { "구글 기프트카드": ("uH8tawUKeO23iQJS", "goo_2"), "문화상품권": ("yw7CRFcPn5Jzyan0", "cul_1"), "컬쳐랜드 상품권": ("uH8tawUKeO23iQJS", "cul_2") }if gift_type not in gift_map: await interaction.response.send_message("지원하지 않는 상품권 종류입니다.", ephemeral=True) returncid, cp = gift_map[gift_type]
# ✅ 쿠키 완전 초기화 jar = aiohttp.CookieJar(unsafe=True) jar.clear() # 모든 기존 쿠키 제거cookies = { "PHPSESSID": "", "bank_accounts": json.dumps([{ "bank_seq": "1", "bank_code": bank_code, "bank_acct_no": account, "user_name": holder, "phone": "010-0000-0000" }]) }payload = { "token": "", "order_items": [{ "type": "pin", "cid": cid, "cp": cp, "pin": gift_number.replace(" ", ""), "coupon_type": None }], "bank_info": { "bank_seq": "1", "bank_code": bank_code, "bank_acct_no": account, "user_name": holder, "phone": "010-0000-0000" } }headers = { "Content-Type": "application/json", "Referer": "https://momopin.co.kr/new", "Origin": "https://momopin.co.kr", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)", "Accept": "application/json, text/plain, */*", "Cache-Control": "no-cache", "Pragma": "no-cache", }async with aiohttp.ClientSession(cookie_jar=jar) as session: # 1️⃣ 먼저 사이트 접속해서 초기 쿠키 받아오기 async with session.get("https://momopin.co.kr/new", headers=headers) as init_resp: print(f"✅ 초기 접속 완료, status={init_resp.status}") # 서버가 보내준 쿠키가 jar에 자동 저장됨# 2️⃣ 기존 쿠키 제거 후, 필요한 쿠키만 수동 세팅 session.cookie_jar.clear() for k, v in cookies.items(): print("초기화") session.cookie_jar.update_cookies({k: v})# 3️⃣ POST 요청으로 상품권 제출 async with session.post( "https://momopin.co.kr/datas/order.submit", headers=headers, json=payload ) as resp: text = await resp.text() print(f"📨 서버 응답: {text}")try: data = json.loads(text) except json.JSONDecodeError: data = {}is_invalid = False if data.get("error") == 444: is_invalid = True elif isinstance(data.get("result"), dict) and data["result"].get("error") == 201: is_invalid = Trueif is_invalid: embed = nextcord.Embed( title="<:error1:1425997569712197736> 유효하지 않은 상품권 번호", description=f"{gift_number}은(는) 유효하지 않은 상품권 번호입니다.\n다시 확인해주세요.", color=0xFF5555 ) embed.set_footer(text="자동 환전 시스템") await interaction.user.send(embed=embed) print("❌ 유효하지 않은 PIN 감지됨") returnif resp.status == 200: success_embed = nextcord.Embed( title="<:accepted_correct:1425998427451293818> 자동 신청 완료", description=f"**{gift_type}** 상품권이 정상적으로 등록되었습니다.\n" f"계좌:{account}/ 예금주:{holder}", color=0x55FF55 ) success_embed.set_footer(text="1~2분 내로 입금이 완료됩니다.") await interaction.user.send(embed=success_embed) print("✅ momopin 자동신청 완료")# 🔒 자동 채널 닫기 로직 async def auto_close_channel(): await asyncio.sleep(180) channel = interaction.channel if not channel: returncategory = channel.category if not category or category.id != CATEGORY_ID: returnoverwrites = channel.overwrites target_users = [ user for user in overwrites if isinstance(user, nextcord.Member) and overwrites[user].view_channel ]for user in target_users: await channel.set_permissions(user, overwrite=None) try: role = nextcord.utils.get(channel.guild.roles, id=1425718113785221140) if role and role not in user.roles: await user.add_roles(role, reason="자동 환전 구매 역할 부여") print(f"🎖️ {user}님에게 역할 {role.name} 부여 완료") except Exception as e: print(f"⚠️ 역할 부여 실패 ({user}): {e}")close_embed = nextcord.Embed( title="<:accepted_correct:1425998427451293818> 채널 자동 닫힘", description="환전이 완료되어 채널이 자동으로 닫혔습니다.\n이용해주셔서 감사합니다!" ) await channel.send(embed=close_embed) print(f"🔒 {channel.name} 채널 자동 닫힘 완료")# 💬 DM 리뷰 요청 try: review_embed = nextcord.Embed( title="💬 환전 경험 리뷰 요청", description="환전 경험은 어떠셨나요?\n리뷰를 통해 알려주세요! 🌟", color=0xFFD700 ) review_embed.set_footer(text="여러분의 소중한 피드백은 더 나은 서비스로 이어집니다.")class ReviewButton(nextcord.ui.View): def __init__(self): super().__init__(timeout=None)@nextcord.ui.button(label="리뷰 남기기", style=nextcord.ButtonStyle.gray, emoji="📝") async def review(self, button: nextcord.ui.Button, inter: nextcord.Interaction): class ReviewModal(nextcord.ui.Modal): def __init__(self): super().__init__(title="리뷰 작성하기") self.rating = nextcord.ui.TextInput( label="별점 (1~5 사이 숫자 입력)", placeholder="예: 5", required=True, max_length=1 ) self.comment = nextcord.ui.TextInput( label="리뷰 내용", style=nextcord.TextInputStyle.paragraph, placeholder="환전 속도, 친절도, 전반적 만족도 등을 자유롭게 작성해주세요.", required=True, max_length=300 ) self.add_item(self.rating) self.add_item(self.comment)async def callback(self, modal_inter: nextcord.Interaction): rating = int(self.rating.value) stars = "⭐" * rating comment = self.comment.valuereview_channel = modal_inter.client.get_channel(REVIEW_CHANNEL_ID) if review_channel: embed = nextcord.Embed( title="새로운 환전 리뷰 도착!", color=0x00BFFF ) embed.add_field(name="⭐ 별점", value=f"{stars} ({rating}/5)", inline=False) embed.add_field(name="💬 리뷰 내용", value=comment, inline=False) embed.set_footer( text=f"작성자: {modal_inter.user} | ID: {modal_inter.user.id}" ) await review_channel.send(embed=embed)await modal_inter.response.send_message("리뷰가 성공적으로 제출되었습니다. 감사합니다!", ephemeral=True)await inter.response.send_modal(ReviewModal())
await interaction.user.send(embed=review_embed, view=ReviewButton())
except Exception as e: print(f"⚠️ 리뷰 DM 전송 실패: {e}")asyncio.create_task(auto_close_channel())
else: await interaction.response.send_message(f"❌ 서버 응답 오류 ({resp.status})", ephemeral=True)2025년 10월 12일 12:03 #142800
codingapple키 마스터ip차단을 하면 ip 구매 말고는 딱히 할 수 있는게 없어서 요청횟수를 줄여서 사이트에 부담안가게 쓰는게 좋습니다
-
글쓴이글
2 글 보임 - 1 에서 2 까지 (총 2 중에서)
- 답변은 로그인 후 가능합니다.
