Skip to content

Commit

Permalink
Merge pull request #2145 from QuentinJones/master
Browse files Browse the repository at this point in the history
Update Coomer to get correct performer information
  • Loading branch information
feederbox826 authored Jan 2, 2025
2 parents ba7e93e + 14bed48 commit 0c243b7
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions scrapers/Coomer/Coomer.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,33 @@ def clean_text(details: str) -> str:
details = details.strip()
return details

def post_query(service, user, id):
coomer_getpost_url = f"https://coomer.su/api/v1/{service}/user/{user}/post/{id}"
def user_query (service, user):
if re.match('[0-9]*', user):
coomer_getuser_url = f"https://coomer.su/api/v1/{service}/user/{user}/profile"
log.debug(coomer_getuser_url)
user_lookup_response = requests.get(coomer_getuser_url, headers=headers)
if user_lookup_response.status_code == 200:
data = user_lookup_response.json()
log.debug(data)
return data['name']
return user

def post_query(service, user_id, id):
coomer_getpost_url = f"https://coomer.su/api/v1/{service}/user/{user_id}/post/{id}"
post_lookup_response = requests.get(coomer_getpost_url, headers=headers)

if post_lookup_response.status_code == 200:
data = post_lookup_response.json()
log.debug(data)
post = data['post']
studio = {"Name": user}
user_name = user_query(service, user_id)
studio = {"Name": user_name}
if service == "onlyfans":
studio["URL"] = f"https://onlyfans.com/{user}"
studio["URL"] = f"https://onlyfans.com/{user_name}"
elif service == "fansly":
studio["URL"] = f"https://fansly.com/{user}"
studio["URL"] = f"https://fansly.com/{user_name}"
elif service == "candfans":
studio["URL"] = f"https://candfans.com/{user}"
studio["URL"] = f"https://candfans.com/{user_name}"
else:
debugPrint("No service listed")

Expand All @@ -68,18 +80,16 @@ def post_query(service, user, id):
"URL": f"https://coomer.su/{post['service']}/user/{post['user']}/post/{post['id']}",
"Details": clean_text(post['content']),
"Studio": studio,
"Performers": [{"Name": user}],
"Performers": [{"Name": user_name, "urls": [studio['URL']]}],
"Tags": tags
}


log.debug(out)
return out
else:
debugPrint(f'Response: {str(post_lookup_response.status_code)} \n Text: {str(post_lookup_response.text)}')

def get_scene(inputurl):
debugPrint(inputurl)
def get_scene(inputurl):
match = re.search(r'/(\w+?)/user/(.+?)/post/(\d+)', inputurl)
if match:
service = match.group(1)
Expand All @@ -102,17 +112,17 @@ def sceneByFragment(fragment):

hash_lookup_response = requests.get(coomer_searchhash_url + str(readable_hash), headers=headers)


if hash_lookup_response.status_code == 200:
data = hash_lookup_response.json()
post = data['posts'][0] # Not sure why there would be more than one result, we'll just use the first one

return post_query(post['service'], post['user'], post['id'])

else:
debugPrint("The hash of the file was not found. Please make sure you are using an original file.")



if sys.argv[1] == 'sceneByURL':
i = readJSONInput()
log.debug(i)
Expand Down

0 comments on commit 0c243b7

Please sign in to comment.