|
|
|
@ -85,7 +85,33 @@ class Task:
|
|
|
|
|
bg.paste(img, (x_start + x_offset, y_start + y_offset))
|
|
|
|
|
return bg
|
|
|
|
|
|
|
|
|
|
async def post_image(self, image: BytesIO) -> str:
|
|
|
|
|
async def post_image_lewd(self, image) -> str:
|
|
|
|
|
timeout = aiohttp.ClientTimeout(total=5)
|
|
|
|
|
|
|
|
|
|
data = aiohttp.FormData()
|
|
|
|
|
data.add_field('fileToUpload', image, filename='lol.jpg', content_type='image/jpg')
|
|
|
|
|
data.add_field('exifData', 'Yes')
|
|
|
|
|
data.add_field('submiter', 'Upload')
|
|
|
|
|
data.add_field('iUrl', '')
|
|
|
|
|
data.add_field('iUrlb', '')
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
async with aiohttp.ClientSession(
|
|
|
|
|
timeout=timeout,
|
|
|
|
|
headers={"User-Agent": "w0w"}) as session:
|
|
|
|
|
async with session.post('https://lewd.pics/p/', data=data) as resp:
|
|
|
|
|
body = await resp.read()
|
|
|
|
|
|
|
|
|
|
re_rule = R"lewd\.pics\/p\/([a-zA-Z.]+)\""
|
|
|
|
|
blobs = re.findall(re_rule, body.decode())
|
|
|
|
|
uid = blobs[0]
|
|
|
|
|
|
|
|
|
|
return f"https://lewd.pics/p/{uid}"
|
|
|
|
|
|
|
|
|
|
except Exception as ex:
|
|
|
|
|
raise Exception("Could not upload file to lewd.pics :((")
|
|
|
|
|
|
|
|
|
|
async def post_image_uguu(self, image: BytesIO) -> str:
|
|
|
|
|
url = 'https://uguu.se/upload.php'
|
|
|
|
|
timeout = aiohttp.ClientTimeout(total=5)
|
|
|
|
|
|
|
|
|
@ -247,9 +273,9 @@ async def main():
|
|
|
|
|
image_bytes.seek(0)
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
url = await task.post_image(image_bytes)
|
|
|
|
|
url = await task.post_image_lewd(image_bytes)
|
|
|
|
|
except Exception as ex:
|
|
|
|
|
_err(task, err=f"uguu upload: {ex}")
|
|
|
|
|
_err(task, err=f"image upload: {ex}")
|
|
|
|
|
_lower_author_task_count(task.author)
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|