instapaper-scraper 1.1.0__py3-none-any.whl → 1.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- instapaper_scraper/output.py +16 -4
- {instapaper_scraper-1.1.0.dist-info → instapaper_scraper-1.1.1.dist-info}/METADATA +22 -14
- {instapaper_scraper-1.1.0.dist-info → instapaper_scraper-1.1.1.dist-info}/RECORD +7 -7
- {instapaper_scraper-1.1.0.dist-info → instapaper_scraper-1.1.1.dist-info}/WHEEL +0 -0
- {instapaper_scraper-1.1.0.dist-info → instapaper_scraper-1.1.1.dist-info}/entry_points.txt +0 -0
- {instapaper_scraper-1.1.0.dist-info → instapaper_scraper-1.1.1.dist-info}/licenses/LICENSE +0 -0
- {instapaper_scraper-1.1.0.dist-info → instapaper_scraper-1.1.1.dist-info}/top_level.txt +0 -0
instapaper_scraper/output.py
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import os
|
|
2
|
-
import json
|
|
3
|
-
import sqlite3
|
|
4
2
|
import logging
|
|
5
|
-
import
|
|
6
|
-
from typing import List, Dict, Any
|
|
3
|
+
from typing import List, Dict, Any, TYPE_CHECKING
|
|
7
4
|
|
|
8
5
|
from .constants import INSTAPAPER_READ_URL, KEY_ID, KEY_TITLE, KEY_URL
|
|
9
6
|
|
|
@@ -19,6 +16,13 @@ LOG_NO_ARTICLES = "No articles found to save."
|
|
|
19
16
|
LOG_SAVED_ARTICLES = "Saved {count} articles to {filename}"
|
|
20
17
|
LOG_UNKNOWN_FORMAT = "Unknown output format: {format}"
|
|
21
18
|
|
|
19
|
+
if TYPE_CHECKING:
|
|
20
|
+
# Import for type-checking purposes, and use an alias
|
|
21
|
+
# to signal to linters like ruff that it is being used.
|
|
22
|
+
import sqlite3 as sqlite3
|
|
23
|
+
|
|
24
|
+
__all__ = ["sqlite3"]
|
|
25
|
+
|
|
22
26
|
|
|
23
27
|
def get_sqlite_create_table_sql(add_instapaper_url: bool = False) -> str:
|
|
24
28
|
"""Returns the SQL statement to create the articles table."""
|
|
@@ -28,6 +32,8 @@ def get_sqlite_create_table_sql(add_instapaper_url: bool = False) -> str:
|
|
|
28
32
|
f"{KEY_URL} TEXT NOT NULL",
|
|
29
33
|
]
|
|
30
34
|
if add_instapaper_url:
|
|
35
|
+
import sqlite3
|
|
36
|
+
|
|
31
37
|
# The GENERATED ALWAYS AS syntax was added in SQLite 3.31.0
|
|
32
38
|
if sqlite3.sqlite_version_info >= (3, 31, 0):
|
|
33
39
|
columns.append(
|
|
@@ -55,6 +61,8 @@ def save_to_csv(
|
|
|
55
61
|
data: List[Dict[str, Any]], filename: str, add_instapaper_url: bool = False
|
|
56
62
|
) -> None:
|
|
57
63
|
"""Saves a list of articles to a CSV file."""
|
|
64
|
+
import csv
|
|
65
|
+
|
|
58
66
|
os.makedirs(os.path.dirname(filename), exist_ok=True)
|
|
59
67
|
with open(filename, "w", newline="", encoding="utf-8") as f:
|
|
60
68
|
fieldnames = [KEY_ID, KEY_TITLE, KEY_URL]
|
|
@@ -71,6 +79,8 @@ def save_to_csv(
|
|
|
71
79
|
|
|
72
80
|
def save_to_json(data: List[Dict[str, Any]], filename: str) -> None:
|
|
73
81
|
"""Saves a list of articles to a JSON file."""
|
|
82
|
+
import json
|
|
83
|
+
|
|
74
84
|
os.makedirs(os.path.dirname(filename), exist_ok=True)
|
|
75
85
|
with open(filename, "w", encoding="utf-8") as f:
|
|
76
86
|
json.dump(data, f, indent=JSON_INDENT, ensure_ascii=False)
|
|
@@ -81,6 +91,8 @@ def save_to_sqlite(
|
|
|
81
91
|
data: List[Dict[str, Any]], db_name: str, add_instapaper_url: bool = False
|
|
82
92
|
) -> None:
|
|
83
93
|
"""Saves a list of articles to a SQLite database."""
|
|
94
|
+
import sqlite3
|
|
95
|
+
|
|
84
96
|
os.makedirs(os.path.dirname(db_name), exist_ok=True)
|
|
85
97
|
conn = sqlite3.connect(db_name)
|
|
86
98
|
cursor = conn.cursor()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: instapaper-scraper
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.1
|
|
4
4
|
Summary: A tool to scrape articles from Instapaper.
|
|
5
5
|
Project-URL: Homepage, https://github.com/chriskyfung/InstapaperScraper
|
|
6
6
|
Project-URL: Source, https://github.com/chriskyfung/InstapaperScraper
|
|
@@ -43,12 +43,19 @@ Requires-Dist: build; extra == "dev"
|
|
|
43
43
|
Requires-Dist: twine; extra == "dev"
|
|
44
44
|
Requires-Dist: mypy; extra == "dev"
|
|
45
45
|
Requires-Dist: pre-commit; extra == "dev"
|
|
46
|
+
Requires-Dist: licensecheck; extra == "dev"
|
|
46
47
|
Dynamic: license-file
|
|
47
48
|
|
|
48
49
|
# Instapaper Scraper
|
|
49
50
|
|
|
50
51
|
<!-- Badges -->
|
|
51
52
|
<p align="center">
|
|
53
|
+
<a href="https://pypi.org/project/instapaper-scraper/">
|
|
54
|
+
<img src="https://img.shields.io/pypi/v/instapaper-scraper.svg" alt="PyPI version">
|
|
55
|
+
</a>
|
|
56
|
+
<a href="https://pepy.tech/projects/instapaper-scraper">
|
|
57
|
+
<img src="https://static.pepy.tech/personalized-badge/instapaper-scraper?period=total&left_text=downloads" alt="PyPI Downloads">
|
|
58
|
+
</a>
|
|
52
59
|
<a href="https://github.com/chriskyfung/InstapaperScraper">
|
|
53
60
|
<img src="https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fraw.githubusercontent.com%2Fchriskyfung%2FInstapaperScraper%2Frefs%2Fheads%2Fmaster%2Fpyproject.toml" alt="Python Version from PEP 621 TOML">
|
|
54
61
|
</a>
|
|
@@ -58,23 +65,18 @@ Dynamic: license-file
|
|
|
58
65
|
<a href="https://codecov.io/gh/chriskyfung/InstapaperScraper">
|
|
59
66
|
<img src="https://codecov.io/gh/chriskyfung/InstapaperScraper/graph/badge.svg" alt="Code Coverage">
|
|
60
67
|
</a>
|
|
68
|
+
<wbr />
|
|
61
69
|
<a href="https://github.com/chriskyfung/InstapaperScraper/actions/workflows/ci.yml">
|
|
62
70
|
<img src="https://github.com/chriskyfung/InstapaperScraper/actions/workflows/ci.yml/badge.svg" alt="CI Status">
|
|
63
71
|
</a>
|
|
64
|
-
<a href="https://pypi.org/project/instapaper-scraper/">
|
|
65
|
-
<img src="https://img.shields.io/pypi/v/instapaper-scraper.svg" alt="PyPI version">
|
|
66
|
-
</a>
|
|
67
|
-
<a href="https://pepy.tech/projects/instapaper-scraper">
|
|
68
|
-
<img src="https://static.pepy.tech/personalized-badge/instapaper-scraper?period=total&left_text=downloads" alt="PyPI Downloads">
|
|
69
|
-
</a>
|
|
70
72
|
<a href="https://www.gnu.org/licenses/gpl-3.0.en.html">
|
|
71
73
|
<img src="https://img.shields.io/github/license/chriskyfung/InstapaperScraper" alt="GitHub License">
|
|
72
74
|
</a>
|
|
73
75
|
<a href="https://github.com/sponsors/chriskyfung" title="Sponsor on GitHub">
|
|
74
|
-
<img src="https://img.shields.io/badge/Sponsor-GitHub-
|
|
76
|
+
<img src="https://img.shields.io/badge/Sponsor-GitHub-blue?logo=github-sponsors&colorA=263238&colorB=EC407A" alt="GitHub Sponsors Default">
|
|
75
77
|
</a>
|
|
76
|
-
<a href="https://www.buymeacoffee.com/chriskyfung" title="
|
|
77
|
-
<img src="https://img.shields.io/badge/Support
|
|
78
|
+
<a href="https://www.buymeacoffee.com/chriskyfung" title="Support Coffee">
|
|
79
|
+
<img src="https://img.shields.io/badge/Support-Coffee-ffdd00?logo=buy-me-a-coffee&logoColor=ffdd00&colorA=263238" alt="Buy Me A Coffee">
|
|
78
80
|
</a>
|
|
79
81
|
</p>
|
|
80
82
|
|
|
@@ -336,6 +338,13 @@ To run static type checking with `mypy`:
|
|
|
336
338
|
mypy src
|
|
337
339
|
```
|
|
338
340
|
|
|
341
|
+
To run license checks:
|
|
342
|
+
|
|
343
|
+
```sh
|
|
344
|
+
licensecheck --show-only-failing
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
|
|
339
348
|
## 📜 Disclaimer
|
|
340
349
|
|
|
341
350
|
This script requires valid Instapaper credentials. Use it responsibly and in accordance with Instapaper’s Terms of Service.
|
|
@@ -344,9 +353,8 @@ This script requires valid Instapaper credentials. Use it responsibly and in acc
|
|
|
344
353
|
|
|
345
354
|
This project is licensed under the terms of the **GNU General Public License v3.0**. See the [LICENSE](LICENSE) file for the full license text.
|
|
346
355
|
|
|
347
|
-
##
|
|
356
|
+
## Contributors
|
|
348
357
|
|
|
349
|
-
|
|
358
|
+
[](https://github.com/chriskyfung/InstapaperScraper/graphs/contributors)
|
|
350
359
|
|
|
351
|
-
|
|
352
|
-
- **[Buy Me a Coffee](https://www.buymeacoffee.com/chriskyfung):** Perfect for a one-time thank you.
|
|
360
|
+
Made with [contrib.rocks](https://contrib.rocks).
|
|
@@ -4,10 +4,10 @@ instapaper_scraper/auth.py,sha256=OpgjbdI697FitumiyznWjey5-R2ZuxAEATaMz9NNnTc,70
|
|
|
4
4
|
instapaper_scraper/cli.py,sha256=YL9c7kksmj5iGKRvVqG0KO4rBbhTg5c9Lgvsf_brRPA,7579
|
|
5
5
|
instapaper_scraper/constants.py,sha256=ubFWa47985lIz58qokMC0xQzTmCB6NOa17KFgWLn65E,403
|
|
6
6
|
instapaper_scraper/exceptions.py,sha256=CptHoZe4NOhdjOoyXkZEMFgQC6oKtzjRljywwDEtsTg,134
|
|
7
|
-
instapaper_scraper/output.py,sha256=
|
|
8
|
-
instapaper_scraper-1.1.
|
|
9
|
-
instapaper_scraper-1.1.
|
|
10
|
-
instapaper_scraper-1.1.
|
|
11
|
-
instapaper_scraper-1.1.
|
|
12
|
-
instapaper_scraper-1.1.
|
|
13
|
-
instapaper_scraper-1.1.
|
|
7
|
+
instapaper_scraper/output.py,sha256=cadyUOaGQ5Ct5iLiEkHDvN2cqYc1WmJTvAa7OxFjg0w,5618
|
|
8
|
+
instapaper_scraper-1.1.1.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
|
|
9
|
+
instapaper_scraper-1.1.1.dist-info/METADATA,sha256=CDiUTjY5eu1OTlFhhBNA1irP6gTNTLw6Ra-RIbkJeKY,14320
|
|
10
|
+
instapaper_scraper-1.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
11
|
+
instapaper_scraper-1.1.1.dist-info/entry_points.txt,sha256=7AvRgN5fvtas_Duxdz-JPbDN6A1Lq2GaTfTSv54afxA,67
|
|
12
|
+
instapaper_scraper-1.1.1.dist-info/top_level.txt,sha256=kiU9nLkqPOVPLsP4QMHuBFjAmoIKfftYmGV05daLrcc,19
|
|
13
|
+
instapaper_scraper-1.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|