shmugoh / sv-dlp Goto Github PK
View Code? Open in Web Editor NEWFlexible Street View API Wrapper
Home Page: https://shmugo.co/sv-dlp/
License: MIT License
Flexible Street View API Wrapper
Home Page: https://shmugo.co/sv-dlp/
License: MIT License
Been re-reading this script after 2 weeks of procrastinating, and holy crap some of it is so dirty. Some variables/modules aren't named well (mostly in the extractor side), some functions' algorithms are too dirty to read, and the way the extractor works is just weird (idk how to explain it).
I'd suggest doing the following:
I don't really think this extractor name is very adequate, since it doesn't really act like a "extractor" - All it does is make API calls.
GitHub Workflow is very painful to troubleshoot, and attempting to automate mkdocs with every new version is gonna cause more issues (and more meaningless commits!); readthedocs does it all automatically, which saves me a lot of time.
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Python311\Scripts\sv-dlp.exe\__main__.py", line 7, in <module>
File "C:\Python311\Lib\site-packages\sv_dlp\__main__.py", line 140, in main
img = sv_dlp.download_panorama(pano_id=pano, lat=lat, lng=lng, zoom=zoom)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\sv_dlp\__init__.py", line 153, in download_panorama
tile_arr = self.service._build_tile_arr(self.metadata, zoom)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\sv_dlp\services\yandex.py", line 179, in _build_tile_arr
zoom = max_zoom - zoom
~~~~~~~~~^~~~~~
TypeError: unsupported operand type(s) for -: 'int' and 'str'
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Python311\Scripts\sv-dlp.exe\__main__.py", line 7, in <module>
File "C:\Python311\Lib\site-packages\sv_dlp\__main__.py", line 140, in main
img = sv_dlp.download_panorama(pano_id=pano, lat=lat, lng=lng, zoom=zoom)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\sv_dlp\__init__.py", line 153, in download_panorama
tile_arr = self.service._build_tile_arr(self.metadata, zoom)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\sv_dlp\services\google\__init__.py", line 209, in _build_tile_arr
x_axis = metadata.size[0][zoom][0][1] // metadata.size[1][1]
~~~~~~~~~~~~~~~~^^^^^^
TypeError: list indices must be integers or slices, not str
Discussion moved into #22
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Python311\Scripts\sv-dlp.exe\__main__.py", line 7, in <module>
File "C:\Python311\Lib\site-packages\sv_dlp\__main__.py", line 131, in main
sv_dlp.get_metadata(pano_id=pano, lat=lat, lng=lng, get_linked_panos=args.linked_panos)
File "C:\Python311\Lib\site-packages\sv_dlp\__init__.py", line 239, in get_metadata
md = self.service.metadata.get_metadata(pano_id=pano_id, lat=lat, lng=lng, get_linked_panos=get_linked_panos)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\sv_dlp\services\google\__init__.py", line 125, in get_metadata
md = metadata._parse_panorama(md, raw_md, output="linked_panos")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\sv_dlp\services\google\__init__.py", line 150, in _parse_panorama
md["linked_panos"] = {}
~~^^^^^^^^^^^^^^^^
TypeError: 'MetadataStructure' object does not support item assignment
Cropping...
Traceback (most recent call last):
File "__main__.py", line 249, in <module>
File "__main__.py", line 181, in main
File "download/download.py", line 85, in panorama
File "PIL/Image.py", line 2209, in save
FileNotFoundError: [Errno 2] No such file or directory: './.\\/ZKtxVmsrUTRvD_7HgCm28A.png'
[64368] Failed to execute script '__main__' due to unhandled exception!
A temporal fix to this would be parsing a --folder flag with two quotes and no value (''
)
After a lot, but A LOT of commits tinkering with the Actions script (such as using UPX and installing required system modules for Linux), I just came to the conclusion that pillow_heif is dramatically doubling the file size from 26.6MB up to 43.7MB on Linux.
Windows is the less affected by this, although I had to drop support for x86 due to pillow_heif not supporting it (although let's be real, who uses x86 nowadays?)
Until pillow_heif gets optimized for pyinstaller or an alternative comes out, I won't fix this.
GeoPhotoService.GetMetadata will be used as a complex replacement for metadata, with the additional bonus of using previous panoramas.
Although for zoom level, will have to revert to the technique used in commit ec38694526e7239fa289d7f0b1b9b2cf7b998b2d.
I have been consistently encountering a 401 error every time I make (the Short URL) API call to requestJsonpV2
.
It requires a valid callback ID, however, I have been unable to find a way to generate a valid one, as they inmediately expire whenever they're used.
I've been trying to access the Yandex Short URL API as of lately (since sv-dlp doesn't really short Yandex links by the API. It just shorts them by parsing the panorama on a long link) but it requires a few tokens - csrfToken
isn't a problem, as Yandex will generate you one if you input an invalid one, but I'm not sure about the s
and sessionId
.
By using ones that I've already generated by myself (as seen in the picture), it returns me a 403 error with the following message
Help is appreciated
...except for zoom zero
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.