Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use API to get_user_str_from_profile #325

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cyberdrop_dl/scraper/crawlers/coomer_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,12 @@
return soup.select_one("a[class=post__user-name]").text

async def get_user_str_from_profile(self, scrape_item: ScrapeItem) -> str:
"""Gets the user string from a scrape item."""
"""Gets the user string from a scrape item"""
service, user = await self.get_service_and_user(scrape_item)
Copy link

@lerroynick lerroynick Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove await. await cant return tuples, and get_service_and_user is has not anything asyncable anyway :)
Then it works.

api_call = self.api_url / service / "user" / user / "profile"
async with self.request_limiter:
soup: BeautifulSoup = await self.client.get_soup(self.domain, scrape_item.url, origin=scrape_item)
return soup.select_one("span[itemprop=name]").text
user_data = await self.client.get_json(self.domain, api_call)
return user_data['name']

Check failure on line 225 in cyberdrop_dl/scraper/crawlers/coomer_crawler.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (Q000)

cyberdrop_dl/scraper/crawlers/coomer_crawler.py:225:30: Q000 Single quotes found but double quotes preferred

@staticmethod
def get_service_and_user(scrape_item: ScrapeItem) -> tuple[str, str]:
Expand Down
Loading