Skip to content

Commit

Permalink
fix #41
Browse files Browse the repository at this point in the history
  • Loading branch information
Quan666 committed Jul 15, 2024
1 parent ea138a0 commit 2e4ddae
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pikpakapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ def get_headers(self, access_token: Optional[str] = None) -> Dict[str, str]:
Returns the headers to use for the requests.
"""
headers = {
"User-Agent": self.build_custom_user_agent(),
"User-Agent": (
self.build_custom_user_agent()
if self.captcha_token
else "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
),
"Content-Type": "application/json; charset=utf-8",
}

Expand Down Expand Up @@ -662,7 +666,7 @@ async def get_download_url(self, file_id: str) -> Dict[str, Any]:
result = await self._request_get(
url=f"https://{self.PIKPAK_API_HOST}/drive/v1/files/{file_id}?",
)

self.captcha_token = None
return result

async def file_rename(self, id: str, new_file_name: str) -> Dict[str, Any]:
Expand Down

0 comments on commit 2e4ddae

Please sign in to comment.