Skip to content

Commit

Permalink
Rewrite entire codebase. Professionalism and that. Innit
Browse files Browse the repository at this point in the history
  • Loading branch information
king-millez committed Dec 23, 2022
1 parent a91ada1 commit 691021c
Show file tree
Hide file tree
Showing 11 changed files with 242 additions and 466 deletions.
76 changes: 0 additions & 76 deletions CODE_OF_CONDUCT.md

This file was deleted.

28 changes: 9 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,16 @@ A tool written in Python to download all Snapmaps content from a specific locati

## Setup

`pip3 install snapmap-archiver`
`pip install snapmap-archiver`

[View on PyPI](https://pypi.org/project/snapmap-archiver/)

Install dependencies with `pip3`.
Install dependencies with `pip`.

```sh
pip3 install -r requirements.txt
pip install -r requirements.txt
```

### Install [aria2c](http://aria2.github.io/)

Download `aria2c` from here:

[https://aria2.github.io/](https://aria2.github.io/)

This is the downloader used for the fastest Snap download speeds.

## Usage

```sh
Expand All @@ -45,12 +37,12 @@ python3 -m snapmap_archiver -o ~/Desktop/snap -l='123.123,123.123' -l '445.445,4

#### Input File

With `-t`, you can specify a file containing a list of line-separated Snap URLs or IDs.
With `-f` or `--file`, you can specify a file containing a list of line-separated Snap URLs or IDs.

E.g

```sh
python3 -m snapmap_archiver -o ~/Desktop/snap -t ~/snaps.txt
python3 -m snapmap_archiver -o ~/Desktop/snaps -t ~/Desktop/snaps.txt
```

Inside `snaps.txt`:
Expand All @@ -64,20 +56,18 @@ https://map.snapchat.com/ttp/snap/Example/

#### Snap URL

You can also just pass 1 or more normal Snap URLs to the package to download it individually like this:
You can also just pass 1 or more normal Snap URLs or IDs to the package to download it individually like this:

```sh
python3 -m snapmap_archiver -o ~/Desktop/snap 'https://map.snapchat.com/ttp/snap/Example/@-33.643495,115.741281,11.86z'
python3 -m snapmap_archiver -o ~/Desktop/snap 'https://map.snapchat.com/ttp/snap/Example/@-33.643495,115.741281,11.86z' 'Example'
```

#### Export JSON

You can export a JSON file with info about downloaded snaps with the `--write-json` argument, which will contain information like the time the Snap was posted, and the Snap location.

It will write `archive.json` to the specified output directory.

#### Snap Radius

The radius from the coordinates you provide that will be included for downloads. `-r 20000` will download all Snaps within a 20km radius of your coordinates.

#### No Overlay

By default the script merges the video and the overlay file into one file. With the `--no-overlay` argument you can disable this and only download the raw video.
43 changes: 21 additions & 22 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
from setuptools import setup, find_packages
import pathlib
# -*- coding: utf-8 -*-
"""setup.py: setuptools control."""

here = pathlib.Path(__file__).parent.resolve()
import re
from setuptools import setup

long_description = (here / "README.md").read_text(encoding="utf-8")
version = '2.0'
with open("README.md", "r") as f:
long_descr = f.read()

setup(
name="snapmap-archiver",
version="1.3.1",
description="Download all Snapmaps content from a specific location.",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/king-millez/snapmap-archiver",
author="king-millez",
author_email="[email protected]",
classifiers=[
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
],
packages=find_packages(),
include_package_data=True,
python_requires=">=3.6",
name = "snapmap-archiver",
packages = ["snapmap_archiver"],
entry_points = {
"console_scripts": ['snapmap-archiver = snapmap_archiver:main']
},
version = version,
description = "Download all Snapmaps content from a specific location.",
long_description = long_descr,
author = "Miles Greenwark",
author_email = "[email protected]",
url = "https://github.com/king-millez/snapmap-archiver",
python_requires=">=3.10",
install_requires=[
"certifi",
"chardet",
"idna",
"requests",
"urllib3",
],
entry_points={"console_scripts": ["snapmap-archiver=snapmap_archiver:main"]},
)
]
)
5 changes: 5 additions & 0 deletions snapmap_archiver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import snapmap_archiver


if __name__ == '__main__':
snapmap_archiver.main()
10 changes: 9 additions & 1 deletion snapmap_archiver/Coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ def __init__(self, coord_str: str):
if ',' not in coord_str:
raise ValueError(f'No comma is present in the provided coordinates.{self.geo_msg}')
try:
self.lat, self.long = coord_str.split(',', 1)
lat, long = coord_str.split(',', 1)
self.lat = float(lat)
self.long = float(long)
except Exception:
raise ValueError(f'Provided coordinates could not be split to lat/long points.{self.geo_msg}')

def __str__(self) -> str:
return f'Lat: {self.lat}, Lon: {self.long}'

def __repr__(self) -> str:
return f'({self.lat},{self.long})'
Loading

0 comments on commit 691021c

Please sign in to comment.