mirror of
https://github.com/rbreu/beeref.git
synced 2026-03-11 08:54:28 +00:00
Easy drag and drop from Pinterest feed (#97)
This commit is contained in:
parent
3151dc4993
commit
fb8515e8ae
2 changed files with 11 additions and 1 deletions
|
|
@ -17,12 +17,13 @@ import logging
|
|||
import os.path
|
||||
import tempfile
|
||||
from urllib.error import URLError
|
||||
from urllib import request
|
||||
from urllib import parse, request
|
||||
|
||||
from PyQt6 import QtGui
|
||||
|
||||
import exif
|
||||
import plum
|
||||
from lxml import etree
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
@ -89,7 +90,15 @@ def load_image(path):
|
|||
return (exif_rotated_image(path), path)
|
||||
|
||||
url = bytes(path.toEncoded()).decode()
|
||||
domain = '.'.join(parse.urlparse(url).netloc.split(".")[-2:])
|
||||
img = exif_rotated_image()
|
||||
if domain == 'pinterest.com':
|
||||
try:
|
||||
page_data = request.urlopen(url).read()
|
||||
root = etree.HTML(page_data)
|
||||
url = root.xpath("//img")[0].get('src')
|
||||
except Exception as e:
|
||||
logger.debug(f'Pinterest image download failed: {e}')
|
||||
try:
|
||||
imgdata = request.urlopen(url).read()
|
||||
except URLError as e:
|
||||
|
|
|
|||
1
setup.py
1
setup.py
|
|
@ -13,6 +13,7 @@ setup(
|
|||
'pyQt6-Qt6>=6.5.0,<=6.6.1',
|
||||
'rectangle-packer>=2.0.1,<=2.0.2',
|
||||
'exif>=1.3.5,<=1.6.0',
|
||||
'lxml==5.1.0'
|
||||
],
|
||||
packages=[
|
||||
'beeref',
|
||||
|
|
|
|||
Loading…
Reference in a new issue