|
2 | 2 |
|
3 | 3 | An anisette data provider, but in a Python package! Based on [pyprovision-uc](https://github.com/JayFoxRox/pyprovision-uc).
|
4 | 4 |
|
5 |
| -Still experimental, and stability of the underlying VM remains to be seen. |
6 |
| - |
7 |
| -## Prerequisites |
8 |
| - |
9 |
| -Libraries from the Apple Music Android app are required to set up the provider at least once. |
10 |
| -The bundle generated from this after initialization can be used for all your future provisioning needs. |
11 |
| - |
12 |
| -The required APK file can be downloaded [here](https://web.archive.org/web/20231226115856/https://apps.mzstatic.com/content/android-apple-music-apk/applemusic.apk). |
13 |
| -The download of this file will eventually be integrated into Anisette.py itself. |
| 5 | +[Documentation](https://docs.mikealmel.ooo/Anisette.py) |
14 | 6 |
|
15 | 7 | ## Usage
|
16 | 8 |
|
17 | 9 | Anisette.py has a very simple API.
|
18 | 10 | You, the developer, are responsible for initializing, loading and saving the state of the Anisette engine, either to memory or to disk.
|
19 | 11 | If you want to keep your provisioning session, you **MUST** save and load the state properly. If you don't, you **WILL** run into errors.
|
| 12 | +See the docs for information on how to do this. |
20 | 13 |
|
21 | 14 | ### Initialization
|
22 | 15 |
|
23 |
| -```python |
24 |
| -from anisette import Anisette |
25 |
| - |
26 |
| -ani = Anisette.init("applemusic.apk") |
27 |
| - |
28 |
| -# Alternatively, you can init from a file-like object: |
29 |
| -with open("applemusic.apk", "rb") as f: |
30 |
| - ani = Anisette.init(f) |
31 |
| -``` |
32 |
| - |
33 |
| -### Saving state |
34 |
| - |
35 |
| -State is saved to two separate bundles: a "provisioning" bundle and a "library" bundle. The provisioning bundle |
36 |
| -is specific to your provisioning session and can **NOT** be shared across sessions. The library bundle **CAN** be |
37 |
| -shared across sessions, but this is not required. It is also possible to save both the provisioning state and libraries |
38 |
| -to a single bundle. This may be easier to work with, but requires more disk space (3-4 megabytes per saved session). |
| 16 | +The Anisette provider must be initialized with libraries from the Apple Music APK. |
| 17 | +To save you some effort, a Cloudflare Worker has been set up to provide easy access to these libraries. |
| 18 | +By default, the Anisette.py will download this library bundle (~3 megabytes) when initializing a new session, |
| 19 | +but you can also provide an APK file or downloaded bundle yourself. |
39 | 20 |
|
40 | 21 | ```python
|
41 |
| -ani.save("bundle.bin") |
42 |
| - |
43 |
| -# Alternatively, to save both bundles separately: |
44 |
| -ani.save("provisioning.bin", "libs.bin") |
45 |
| - |
46 |
| -# You can also use file objects: |
47 |
| -with open("provisioning.bin", "wb+") as pf, open("libs.bin", "wb+") as lf: |
48 |
| - ani.save(pf, lf) |
49 |
| -``` |
50 |
| - |
51 |
| -### Loading state |
52 |
| - |
53 |
| -As mentioned before, if you want to keep your provisioning session across restarts, you must load it properly. |
| 22 | +from anisette import Anisette |
54 | 23 |
|
55 |
| -```python |
56 |
| -ani = Anisette.load("bundle.bin") |
| 24 | +# First use: download from Cloudflare |
| 25 | +ani = Anisette.init() |
57 | 26 |
|
58 |
| -# Alternatively, to load both bundles separately: |
59 |
| -ani = Anisette.load("provisioning.bin", "libs.bin") |
| 27 | +# After download, save library bundle to disk |
| 28 | +ani.save_libs("libs.bin") |
60 | 29 |
|
61 |
| -# Once again, you can also use file objects: |
62 |
| -with open("provisioning.bin", "rb") as pf, open("libs.bin", "rb") as lf: |
63 |
| - ani = Anisette.load(pf, lf) |
| 30 | +# For future use, initialize from disk: |
| 31 | +ani2 = Anisette.init("libs.bin") |
64 | 32 | ```
|
65 | 33 |
|
66 | 34 | ### Getting Anisette data
|
67 | 35 |
|
| 36 | +The first time you call this method will probably take a few seconds since the virtual device needs to be provisioned first. |
| 37 | +After provisioning, getting Anisette data should be quite fast. |
| 38 | + |
68 | 39 | ```python
|
69 | 40 | ani.get_data()
|
70 | 41 |
|
|
0 commit comments