dorksmith 0.1.0__tar.gz → 0.2.1__tar.gz
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.
- {dorksmith-0.1.0 → dorksmith-0.2.1}/.gitignore +3 -0
- {dorksmith-0.1.0 → dorksmith-0.2.1}/PKG-INFO +5 -5
- {dorksmith-0.1.0 → dorksmith-0.2.1}/README.md +4 -4
- {dorksmith-0.1.0 → dorksmith-0.2.1}/pyproject.toml +1 -1
- {dorksmith-0.1.0 → dorksmith-0.2.1}/src/dorksmith/__init__.py +1 -1
- {dorksmith-0.1.0 → dorksmith-0.2.1}/src/dorksmith/data/platforms.json +99 -2
- {dorksmith-0.1.0 → dorksmith-0.2.1}/src/dorksmith/generator.py +1 -1
- {dorksmith-0.1.0 → dorksmith-0.2.1}/src/dorksmith/normalizer.py +24 -2
- {dorksmith-0.1.0 → dorksmith-0.2.1}/src/dorksmith/quoting.py +8 -2
- {dorksmith-0.1.0 → dorksmith-0.2.1}/tests/test_golden.py +1 -1
- dorksmith-0.2.1/tests/test_phrases.py +42 -0
- {dorksmith-0.1.0 → dorksmith-0.2.1}/tests/test_unit.py +14 -0
- {dorksmith-0.1.0 → dorksmith-0.2.1}/LICENSE +0 -0
- {dorksmith-0.1.0 → dorksmith-0.2.1}/scripts/sync_catalogs.py +0 -0
- {dorksmith-0.1.0 → dorksmith-0.2.1}/src/dorksmith/analyzer.py +0 -0
- {dorksmith-0.1.0 → dorksmith-0.2.1}/src/dorksmith/catalogs.py +0 -0
- {dorksmith-0.1.0 → dorksmith-0.2.1}/src/dorksmith/cli.py +0 -0
- {dorksmith-0.1.0 → dorksmith-0.2.1}/src/dorksmith/data/filetypes.json +0 -0
- {dorksmith-0.1.0 → dorksmith-0.2.1}/src/dorksmith/data/intents.json +0 -0
- {dorksmith-0.1.0 → dorksmith-0.2.1}/src/dorksmith/data/operators.google.json +0 -0
- {dorksmith-0.1.0 → dorksmith-0.2.1}/src/dorksmith/errors.py +0 -0
- {dorksmith-0.1.0 → dorksmith-0.2.1}/src/dorksmith/handles.py +0 -0
- {dorksmith-0.1.0 → dorksmith-0.2.1}/src/dorksmith/infer.py +0 -0
- {dorksmith-0.1.0 → dorksmith-0.2.1}/src/dorksmith/placeholders.py +0 -0
- {dorksmith-0.1.0 → dorksmith-0.2.1}/src/dorksmith/py.typed +0 -0
- {dorksmith-0.1.0 → dorksmith-0.2.1}/src/dorksmith/ranker.py +0 -0
- {dorksmith-0.1.0 → dorksmith-0.2.1}/src/dorksmith/resolver.py +0 -0
- {dorksmith-0.1.0 → dorksmith-0.2.1}/src/dorksmith/validator.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: dorksmith
|
|
3
|
-
Version: 0.1
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Deterministic search-dork generator and OSINT/SOCMINT query engine. Catalog-driven, pure Python, no dependencies.
|
|
5
5
|
Project-URL: Homepage, https://github.com/aelena/dorksmith
|
|
6
6
|
Project-URL: Repository, https://github.com/aelena/dorksmith
|
|
@@ -78,7 +78,7 @@ validate_query("cache:example.com site:example.com or filetype:.pdf").warnings
|
|
|
78
78
|
# ["Lower-case 'or' is treated as an ordinary word; ...", "filetype: values take no leading dot ...", "cache: is deprecated: ..."]
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
Results are dataclasses; `.to_dict()` gives the same camelCase shape
|
|
81
|
+
Results are dataclasses; `.to_dict()` gives the same camelCase shape the npm package and the web app use.
|
|
82
82
|
|
|
83
83
|
## API
|
|
84
84
|
|
|
@@ -89,11 +89,11 @@ Results are dataclasses; `.to_dict()` gives the same camelCase shape as the HTTP
|
|
|
89
89
|
| `expand_handle(username, *, categories=None, platform_ids=None, max_platforms=None, catalogs=None)` | Profile URLs (`status` always `not-checked`) and site-scoped queries. |
|
|
90
90
|
| `infer_input_type(text, known_extensions=None)` | Deterministic input-type suggestion. |
|
|
91
91
|
| `search_url(query, engine="google")` | Search-engine URL, percent-encoded locally. |
|
|
92
|
-
| `validate_catalogs(catalogs)` | Structural/cross-reference validation
|
|
92
|
+
| `validate_catalogs(catalogs)` | Structural/cross-reference validation of the catalogs. |
|
|
93
93
|
| `bundled_catalogs()`, `load_catalogs(path)`, `catalog_version()` | Embedded or custom catalogs. |
|
|
94
94
|
| lower-level: `normalize_text`, `try_normalize_domain`, `quote`, `safe_term`, `analyze_query`, `expand_template`, … | Building blocks for custom pipelines. |
|
|
95
95
|
|
|
96
|
-
`options` keys match the
|
|
96
|
+
`options` keys match the npm package: `fileTypes`, `excludeTerms`, `after`, `before`, `site`, `maxVariants`, `organization`, `location`, `role`, `displayName`.
|
|
97
97
|
|
|
98
98
|
### Bring your own catalogs
|
|
99
99
|
|
|
@@ -121,7 +121,7 @@ Exit codes: `0` ok, `2` invalid input (or a query with syntax errors for `valida
|
|
|
121
121
|
```bash
|
|
122
122
|
python -m pip install -e ".[test]"
|
|
123
123
|
python scripts/sync_catalogs.py # copies ../../data/*.json into src/dorksmith/data
|
|
124
|
-
python -m pytest -q # unit tests + the
|
|
124
|
+
python -m pytest -q # unit tests + the 153 golden fixtures from the monorepo
|
|
125
125
|
python -m build # sdist + wheel
|
|
126
126
|
```
|
|
127
127
|
|
|
@@ -28,7 +28,7 @@ validate_query("cache:example.com site:example.com or filetype:.pdf").warnings
|
|
|
28
28
|
# ["Lower-case 'or' is treated as an ordinary word; ...", "filetype: values take no leading dot ...", "cache: is deprecated: ..."]
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
Results are dataclasses; `.to_dict()` gives the same camelCase shape
|
|
31
|
+
Results are dataclasses; `.to_dict()` gives the same camelCase shape the npm package and the web app use.
|
|
32
32
|
|
|
33
33
|
## API
|
|
34
34
|
|
|
@@ -39,11 +39,11 @@ Results are dataclasses; `.to_dict()` gives the same camelCase shape as the HTTP
|
|
|
39
39
|
| `expand_handle(username, *, categories=None, platform_ids=None, max_platforms=None, catalogs=None)` | Profile URLs (`status` always `not-checked`) and site-scoped queries. |
|
|
40
40
|
| `infer_input_type(text, known_extensions=None)` | Deterministic input-type suggestion. |
|
|
41
41
|
| `search_url(query, engine="google")` | Search-engine URL, percent-encoded locally. |
|
|
42
|
-
| `validate_catalogs(catalogs)` | Structural/cross-reference validation
|
|
42
|
+
| `validate_catalogs(catalogs)` | Structural/cross-reference validation of the catalogs. |
|
|
43
43
|
| `bundled_catalogs()`, `load_catalogs(path)`, `catalog_version()` | Embedded or custom catalogs. |
|
|
44
44
|
| lower-level: `normalize_text`, `try_normalize_domain`, `quote`, `safe_term`, `analyze_query`, `expand_template`, … | Building blocks for custom pipelines. |
|
|
45
45
|
|
|
46
|
-
`options` keys match the
|
|
46
|
+
`options` keys match the npm package: `fileTypes`, `excludeTerms`, `after`, `before`, `site`, `maxVariants`, `organization`, `location`, `role`, `displayName`.
|
|
47
47
|
|
|
48
48
|
### Bring your own catalogs
|
|
49
49
|
|
|
@@ -71,7 +71,7 @@ Exit codes: `0` ok, `2` invalid input (or a query with syntax errors for `valida
|
|
|
71
71
|
```bash
|
|
72
72
|
python -m pip install -e ".[test]"
|
|
73
73
|
python scripts/sync_catalogs.py # copies ../../data/*.json into src/dorksmith/data
|
|
74
|
-
python -m pytest -q # unit tests + the
|
|
74
|
+
python -m pytest -q # unit tests + the 153 golden fixtures from the monorepo
|
|
75
75
|
python -m build # sdist + wheel
|
|
76
76
|
```
|
|
77
77
|
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "dorksmith"
|
|
7
|
-
version = "0.1
|
|
7
|
+
version = "0.2.1"
|
|
8
8
|
description = "Deterministic search-dork generator and OSINT/SOCMINT query engine. Catalog-driven, pure Python, no dependencies."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { file = "LICENSE" }
|
|
@@ -29,7 +29,7 @@ from .placeholders import ALL_PLACEHOLDERS, OPTIONAL_BY_DEFAULT, placeholders_in
|
|
|
29
29
|
from .quoting import exclusion, looks_like_syntax, operator_value, or_group, quote, safe_term, safe_terms, unquote
|
|
30
30
|
from .validator import validate_catalogs
|
|
31
31
|
|
|
32
|
-
__version__ = "0.1
|
|
32
|
+
__version__ = "0.2.1"
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
def catalog_version(catalogs: Catalogs | None = None) -> str:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"catalogVersion": "2026-
|
|
3
|
+
"catalogVersion": "2026-12-05",
|
|
4
4
|
"notes": [
|
|
5
5
|
"profileUrlTemplate builds a public profile URL from {username}. A constructible URL never implies the account exists.",
|
|
6
6
|
"searchDomain is used for site: scoped queries. caveat is shown to the user when the URL template alone is unreliable.",
|
|
@@ -113,6 +113,103 @@
|
|
|
113
113
|
{ "id": "buymeacoffee", "name": "Buy Me a Coffee", "category": "regional-other", "profileUrlTemplate": "https://buymeacoffee.com/{username}", "searchDomain": "buymeacoffee.com", "enabled": true, "caseSensitive": false, "weight": 33 },
|
|
114
114
|
{ "id": "ebay", "name": "eBay", "category": "regional-other", "profileUrlTemplate": "https://www.ebay.com/usr/{username}", "searchDomain": "ebay.com", "enabled": true, "caseSensitive": false, "weight": 38 },
|
|
115
115
|
{ "id": "etsy", "name": "Etsy", "category": "regional-other", "profileUrlTemplate": "https://www.etsy.com/shop/{username}", "searchDomain": "etsy.com", "enabled": true, "caseSensitive": false, "weight": 36, "caveat": "Shop names and user handles differ on Etsy." },
|
|
116
|
-
{ "id": "tripadvisor", "name": "Tripadvisor", "category": "regional-other", "profileUrlTemplate": "https://www.tripadvisor.com/Profile/{username}", "searchDomain": "tripadvisor.com", "enabled": true, "caseSensitive": false, "weight": 30 }
|
|
116
|
+
{ "id": "tripadvisor", "name": "Tripadvisor", "category": "regional-other", "profileUrlTemplate": "https://www.tripadvisor.com/Profile/{username}", "searchDomain": "tripadvisor.com", "enabled": true, "caseSensitive": false, "weight": 30 },
|
|
117
|
+
{"id": "ok-ru", "name": "OK.ru (Odnoklassniki)", "category": "regional-other", "profileUrlTemplate": "https://ok.ru/{username}", "searchDomain": "ok.ru", "enabled": true, "caseSensitive": false, "weight": 28, "caveat": "Many OK.ru profiles are only reachable by numeric id."},
|
|
118
|
+
{"id": "myspace", "name": "Myspace", "category": "general-social", "profileUrlTemplate": "https://myspace.com/{username}", "searchDomain": "myspace.com", "enabled": true, "caseSensitive": false, "weight": 18},
|
|
119
|
+
{"id": "imgur", "name": "Imgur", "category": "general-social", "profileUrlTemplate": "https://imgur.com/user/{username}", "searchDomain": "imgur.com", "enabled": true, "caseSensitive": false, "weight": 26},
|
|
120
|
+
{"id": "9gag", "name": "9GAG", "category": "general-social", "profileUrlTemplate": "https://9gag.com/u/{username}", "searchDomain": "9gag.com", "enabled": true, "caseSensitive": false, "weight": 22},
|
|
121
|
+
{"id": "ask-fm", "name": "ASKfm", "category": "general-social", "profileUrlTemplate": "https://ask.fm/{username}", "searchDomain": "ask.fm", "enabled": true, "caseSensitive": false, "weight": 16},
|
|
122
|
+
{"id": "minds", "name": "Minds", "category": "general-social", "profileUrlTemplate": "https://www.minds.com/{username}", "searchDomain": "minds.com", "enabled": true, "caseSensitive": false, "weight": 14},
|
|
123
|
+
{"id": "pixelfed", "name": "Pixelfed (pixelfed.social)", "category": "general-social", "profileUrlTemplate": "https://pixelfed.social/{username}", "searchDomain": "pixelfed.social", "enabled": true, "caseSensitive": false, "weight": 14, "caveat": "Pixelfed is federated; the same handle may live on any instance."},
|
|
124
|
+
{"id": "clubhouse", "name": "Clubhouse", "category": "general-social", "profileUrlTemplate": "https://www.clubhouse.com/@{username}", "searchDomain": "clubhouse.com", "enabled": true, "caseSensitive": false, "weight": 18},
|
|
125
|
+
{"id": "livejournal", "name": "LiveJournal", "category": "general-social", "profileUrlTemplate": "https://{username}.livejournal.com/", "searchDomain": "livejournal.com", "enabled": true, "caseSensitive": false, "weight": 20},
|
|
126
|
+
{"id": "career-habr", "name": "Habr Career", "category": "professional", "profileUrlTemplate": "https://career.habr.com/{username}", "searchDomain": "career.habr.com", "enabled": true, "caseSensitive": false, "weight": 18},
|
|
127
|
+
{"id": "fiverr", "name": "Fiverr", "category": "professional", "profileUrlTemplate": "https://www.fiverr.com/{username}", "searchDomain": "fiverr.com", "enabled": true, "caseSensitive": false, "weight": 24},
|
|
128
|
+
{"id": "freelancer", "name": "Freelancer", "category": "professional", "profileUrlTemplate": "https://www.freelancer.com/u/{username}", "searchDomain": "freelancer.com", "enabled": true, "caseSensitive": false, "weight": 20},
|
|
129
|
+
{"id": "contra", "name": "Contra", "category": "professional", "profileUrlTemplate": "https://contra.com/{username}", "searchDomain": "contra.com", "enabled": true, "caseSensitive": false, "weight": 12},
|
|
130
|
+
{"id": "peerlist", "name": "Peerlist", "category": "professional", "profileUrlTemplate": "https://peerlist.io/{username}", "searchDomain": "peerlist.io", "enabled": true, "caseSensitive": false, "weight": 12},
|
|
131
|
+
{"id": "codementor", "name": "Codementor", "category": "professional", "profileUrlTemplate": "https://www.codementor.io/@{username}", "searchDomain": "codementor.io", "enabled": true, "caseSensitive": false, "weight": 14},
|
|
132
|
+
{"id": "calendly", "name": "Calendly", "category": "professional", "profileUrlTemplate": "https://calendly.com/{username}", "searchDomain": "calendly.com", "enabled": true, "caseSensitive": false, "weight": 16, "caveat": "Calendly links are often first.last or company names, not social handles."},
|
|
133
|
+
{"id": "gist", "name": "GitHub Gist", "category": "developer", "profileUrlTemplate": "https://gist.github.com/{username}", "searchDomain": "gist.github.com", "enabled": true, "caseSensitive": false, "weight": 29},
|
|
134
|
+
{"id": "sourceforge", "name": "SourceForge", "category": "developer", "profileUrlTemplate": "https://sourceforge.net/u/{username}/profile", "searchDomain": "sourceforge.net", "enabled": true, "caseSensitive": false, "weight": 24},
|
|
135
|
+
{"id": "launchpad", "name": "Launchpad", "category": "developer", "profileUrlTemplate": "https://launchpad.net/~{username}", "searchDomain": "launchpad.net", "enabled": true, "caseSensitive": false, "weight": 20},
|
|
136
|
+
{"id": "gitee", "name": "Gitee", "category": "developer", "profileUrlTemplate": "https://gitee.com/{username}", "searchDomain": "gitee.com", "enabled": true, "caseSensitive": false, "weight": 20},
|
|
137
|
+
{"id": "sourcehut", "name": "SourceHut", "category": "developer", "profileUrlTemplate": "https://sr.ht/~{username}/", "searchDomain": "sr.ht", "enabled": true, "caseSensitive": false, "weight": 14},
|
|
138
|
+
{"id": "hackerrank", "name": "HackerRank", "category": "developer", "profileUrlTemplate": "https://www.hackerrank.com/profile/{username}", "searchDomain": "hackerrank.com", "enabled": true, "caseSensitive": false, "weight": 26},
|
|
139
|
+
{"id": "codeforces", "name": "Codeforces", "category": "developer", "profileUrlTemplate": "https://codeforces.com/profile/{username}", "searchDomain": "codeforces.com", "enabled": true, "caseSensitive": false, "weight": 24},
|
|
140
|
+
{"id": "codechef", "name": "CodeChef", "category": "developer", "profileUrlTemplate": "https://www.codechef.com/users/{username}", "searchDomain": "codechef.com", "enabled": true, "caseSensitive": false, "weight": 20},
|
|
141
|
+
{"id": "codewars", "name": "Codewars", "category": "developer", "profileUrlTemplate": "https://www.codewars.com/users/{username}", "searchDomain": "codewars.com", "enabled": true, "caseSensitive": false, "weight": 24},
|
|
142
|
+
{"id": "codecademy", "name": "Codecademy", "category": "developer", "profileUrlTemplate": "https://www.codecademy.com/profiles/{username}", "searchDomain": "codecademy.com", "enabled": true, "caseSensitive": false, "weight": 22},
|
|
143
|
+
{"id": "exercism", "name": "Exercism", "category": "developer", "profileUrlTemplate": "https://exercism.org/profiles/{username}", "searchDomain": "exercism.org", "enabled": true, "caseSensitive": false, "weight": 16},
|
|
144
|
+
{"id": "freecodecamp", "name": "freeCodeCamp", "category": "developer", "profileUrlTemplate": "https://www.freecodecamp.org/{username}", "searchDomain": "freecodecamp.org", "enabled": true, "caseSensitive": false, "weight": 20},
|
|
145
|
+
{"id": "tryhackme", "name": "TryHackMe", "category": "developer", "profileUrlTemplate": "https://tryhackme.com/p/{username}", "searchDomain": "tryhackme.com", "enabled": true, "caseSensitive": false, "weight": 22},
|
|
146
|
+
{"id": "rubygems", "name": "RubyGems", "category": "developer", "profileUrlTemplate": "https://rubygems.org/profiles/{username}", "searchDomain": "rubygems.org", "enabled": true, "caseSensitive": false, "weight": 22},
|
|
147
|
+
{"id": "crates-io", "name": "crates.io", "category": "developer", "profileUrlTemplate": "https://crates.io/users/{username}", "searchDomain": "crates.io", "enabled": true, "caseSensitive": false, "weight": 22, "caveat": "crates.io logins mirror GitHub usernames."},
|
|
148
|
+
{"id": "packagist", "name": "Packagist", "category": "developer", "profileUrlTemplate": "https://packagist.org/users/{username}/", "searchDomain": "packagist.org", "enabled": true, "caseSensitive": false, "weight": 18},
|
|
149
|
+
{"id": "hashnode", "name": "Hashnode", "category": "developer", "profileUrlTemplate": "https://hashnode.com/@{username}", "searchDomain": "hashnode.com", "enabled": true, "caseSensitive": false, "weight": 20},
|
|
150
|
+
{"id": "lobsters", "name": "Lobsters", "category": "developer", "profileUrlTemplate": "https://lobste.rs/~{username}", "searchDomain": "lobste.rs", "enabled": true, "caseSensitive": false, "weight": 18},
|
|
151
|
+
{"id": "jsfiddle", "name": "JSFiddle", "category": "developer", "profileUrlTemplate": "https://jsfiddle.net/user/{username}/", "searchDomain": "jsfiddle.net", "enabled": true, "caseSensitive": false, "weight": 14},
|
|
152
|
+
{"id": "observable", "name": "Observable", "category": "developer", "profileUrlTemplate": "https://observablehq.com/@{username}", "searchDomain": "observablehq.com", "enabled": true, "caseSensitive": false, "weight": 14},
|
|
153
|
+
{"id": "crowdin", "name": "Crowdin", "category": "developer", "profileUrlTemplate": "https://crowdin.com/profile/{username}", "searchDomain": "crowdin.com", "enabled": true, "caseSensitive": false, "weight": 14},
|
|
154
|
+
{"id": "wordpress-org", "name": "WordPress.org profiles", "category": "developer", "profileUrlTemplate": "https://profiles.wordpress.org/{username}/", "searchDomain": "profiles.wordpress.org", "enabled": true, "caseSensitive": false, "weight": 22},
|
|
155
|
+
{"id": "qiita", "name": "Qiita", "category": "developer", "profileUrlTemplate": "https://qiita.com/{username}", "searchDomain": "qiita.com", "enabled": true, "caseSensitive": false, "weight": 18},
|
|
156
|
+
{"id": "zenn", "name": "Zenn", "category": "developer", "profileUrlTemplate": "https://zenn.dev/{username}", "searchDomain": "zenn.dev", "enabled": true, "caseSensitive": false, "weight": 14},
|
|
157
|
+
{"id": "habr", "name": "Habr", "category": "developer", "profileUrlTemplate": "https://habr.com/en/users/{username}/", "searchDomain": "habr.com", "enabled": true, "caseSensitive": false, "weight": 22},
|
|
158
|
+
{"id": "hackernoon", "name": "HackerNoon", "category": "developer", "profileUrlTemplate": "https://hackernoon.com/u/{username}", "searchDomain": "hackernoon.com", "enabled": true, "caseSensitive": false, "weight": 16},
|
|
159
|
+
{"id": "kick", "name": "Kick", "category": "creator-media", "profileUrlTemplate": "https://kick.com/{username}", "searchDomain": "kick.com", "enabled": true, "caseSensitive": false, "weight": 26},
|
|
160
|
+
{"id": "rumble", "name": "Rumble", "category": "creator-media", "profileUrlTemplate": "https://rumble.com/user/{username}", "searchDomain": "rumble.com", "enabled": true, "caseSensitive": false, "weight": 20, "caveat": "Rumble channels live under /c/; user and channel names can differ."},
|
|
161
|
+
{"id": "dailymotion", "name": "Dailymotion", "category": "creator-media", "profileUrlTemplate": "https://www.dailymotion.com/{username}", "searchDomain": "dailymotion.com", "enabled": true, "caseSensitive": false, "weight": 24},
|
|
162
|
+
{"id": "mixcloud", "name": "Mixcloud", "category": "creator-media", "profileUrlTemplate": "https://www.mixcloud.com/{username}/", "searchDomain": "mixcloud.com", "enabled": true, "caseSensitive": false, "weight": 20},
|
|
163
|
+
{"id": "lastfm", "name": "Last.fm", "category": "creator-media", "profileUrlTemplate": "https://www.last.fm/user/{username}", "searchDomain": "last.fm", "enabled": true, "caseSensitive": false, "weight": 26},
|
|
164
|
+
{"id": "audiomack", "name": "Audiomack", "category": "creator-media", "profileUrlTemplate": "https://audiomack.com/{username}", "searchDomain": "audiomack.com", "enabled": true, "caseSensitive": false, "weight": 14},
|
|
165
|
+
{"id": "reverbnation", "name": "ReverbNation", "category": "creator-media", "profileUrlTemplate": "https://www.reverbnation.com/{username}", "searchDomain": "reverbnation.com", "enabled": true, "caseSensitive": false, "weight": 14},
|
|
166
|
+
{"id": "genius", "name": "Genius", "category": "creator-media", "profileUrlTemplate": "https://genius.com/{username}", "searchDomain": "genius.com", "enabled": true, "caseSensitive": false, "weight": 16},
|
|
167
|
+
{"id": "wattpad", "name": "Wattpad", "category": "creator-media", "profileUrlTemplate": "https://www.wattpad.com/user/{username}", "searchDomain": "wattpad.com", "enabled": true, "caseSensitive": false, "weight": 22},
|
|
168
|
+
{"id": "ao3", "name": "Archive of Our Own", "category": "creator-media", "profileUrlTemplate": "https://archiveofourown.org/users/{username}", "searchDomain": "archiveofourown.org", "enabled": true, "caseSensitive": false, "weight": 22},
|
|
169
|
+
{"id": "buzzfeed", "name": "BuzzFeed", "category": "creator-media", "profileUrlTemplate": "https://www.buzzfeed.com/{username}", "searchDomain": "buzzfeed.com", "enabled": true, "caseSensitive": false, "weight": 16},
|
|
170
|
+
{"id": "issuu", "name": "Issuu", "category": "creator-media", "profileUrlTemplate": "https://issuu.com/{username}", "searchDomain": "issuu.com", "enabled": true, "caseSensitive": false, "weight": 16},
|
|
171
|
+
{"id": "giphy", "name": "GIPHY", "category": "creator-media", "profileUrlTemplate": "https://giphy.com/{username}", "searchDomain": "giphy.com", "enabled": true, "caseSensitive": false, "weight": 14},
|
|
172
|
+
{"id": "pastebin", "name": "Pastebin", "category": "creator-media", "profileUrlTemplate": "https://pastebin.com/u/{username}", "searchDomain": "pastebin.com", "enabled": true, "caseSensitive": false, "weight": 24},
|
|
173
|
+
{"id": "gumroad", "name": "Gumroad", "category": "creator-media", "profileUrlTemplate": "https://{username}.gumroad.com/", "searchDomain": "gumroad.com", "enabled": true, "caseSensitive": false, "weight": 18},
|
|
174
|
+
{"id": "blogger", "name": "Blogger", "category": "creator-media", "profileUrlTemplate": "https://{username}.blogspot.com/", "searchDomain": "blogspot.com", "enabled": true, "caseSensitive": false, "weight": 22, "caveat": "Blog sub-domains are chosen per blog and often differ from the author's handle."},
|
|
175
|
+
{"id": "wordpress-com", "name": "WordPress.com", "category": "creator-media", "profileUrlTemplate": "https://{username}.wordpress.com/", "searchDomain": "wordpress.com", "enabled": true, "caseSensitive": false, "weight": 22, "caveat": "Blog sub-domains are chosen per blog and often differ from the author's handle."},
|
|
176
|
+
{"id": "trakt", "name": "Trakt", "category": "creator-media", "profileUrlTemplate": "https://trakt.tv/users/{username}", "searchDomain": "trakt.tv", "enabled": true, "caseSensitive": false, "weight": 14},
|
|
177
|
+
{"id": "myanimelist", "name": "MyAnimeList", "category": "creator-media", "profileUrlTemplate": "https://myanimelist.net/profile/{username}", "searchDomain": "myanimelist.net", "enabled": true, "caseSensitive": false, "weight": 20},
|
|
178
|
+
{"id": "anilist", "name": "AniList", "category": "creator-media", "profileUrlTemplate": "https://anilist.co/user/{username}", "searchDomain": "anilist.co", "enabled": true, "caseSensitive": false, "weight": 16},
|
|
179
|
+
{"id": "discogs", "name": "Discogs", "category": "creator-media", "profileUrlTemplate": "https://www.discogs.com/user/{username}", "searchDomain": "discogs.com", "enabled": true, "caseSensitive": false, "weight": 18},
|
|
180
|
+
{"id": "audiojungle", "name": "AudioJungle (Envato)", "category": "creator-media", "profileUrlTemplate": "https://audiojungle.net/user/{username}", "searchDomain": "audiojungle.net", "enabled": true, "caseSensitive": false, "weight": 12},
|
|
181
|
+
{"id": "slashdot", "name": "Slashdot", "category": "forums-community", "profileUrlTemplate": "https://slashdot.org/~{username}", "searchDomain": "slashdot.org", "enabled": true, "caseSensitive": false, "weight": 14},
|
|
182
|
+
{"id": "instructables", "name": "Instructables", "category": "forums-community", "profileUrlTemplate": "https://www.instructables.com/member/{username}/", "searchDomain": "instructables.com", "enabled": true, "caseSensitive": false, "weight": 16},
|
|
183
|
+
{"id": "trello", "name": "Trello", "category": "forums-community", "profileUrlTemplate": "https://trello.com/u/{username}", "searchDomain": "trello.com", "enabled": true, "caseSensitive": false, "weight": 16},
|
|
184
|
+
{"id": "fandom", "name": "Fandom", "category": "forums-community", "profileUrlTemplate": "https://community.fandom.com/wiki/User:{username}", "searchDomain": "fandom.com", "enabled": true, "caseSensitive": false, "weight": 20},
|
|
185
|
+
{"id": "openstreetmap", "name": "OpenStreetMap", "category": "forums-community", "profileUrlTemplate": "https://www.openstreetmap.org/user/{username}", "searchDomain": "openstreetmap.org", "enabled": true, "caseSensitive": false, "weight": 18},
|
|
186
|
+
{"id": "tradingview", "name": "TradingView", "category": "forums-community", "profileUrlTemplate": "https://www.tradingview.com/u/{username}/", "searchDomain": "tradingview.com", "enabled": true, "caseSensitive": false, "weight": 18},
|
|
187
|
+
{"id": "untappd", "name": "Untappd", "category": "forums-community", "profileUrlTemplate": "https://untappd.com/user/{username}", "searchDomain": "untappd.com", "enabled": true, "caseSensitive": false, "weight": 14},
|
|
188
|
+
{"id": "namemc", "name": "NameMC (Minecraft)", "category": "gaming", "profileUrlTemplate": "https://namemc.com/profile/{username}", "searchDomain": "namemc.com", "enabled": true, "caseSensitive": false, "weight": 22},
|
|
189
|
+
{"id": "osu", "name": "osu!", "category": "gaming", "profileUrlTemplate": "https://osu.ppy.sh/users/{username}", "searchDomain": "osu.ppy.sh", "enabled": true, "caseSensitive": false, "weight": 20},
|
|
190
|
+
{"id": "faceit", "name": "FACEIT", "category": "gaming", "profileUrlTemplate": "https://www.faceit.com/en/players/{username}", "searchDomain": "faceit.com", "enabled": true, "caseSensitive": false, "weight": 20},
|
|
191
|
+
{"id": "gog", "name": "GOG", "category": "gaming", "profileUrlTemplate": "https://www.gog.com/u/{username}", "searchDomain": "gog.com", "enabled": true, "caseSensitive": false, "weight": 16},
|
|
192
|
+
{"id": "boardgamegeek", "name": "BoardGameGeek", "category": "gaming", "profileUrlTemplate": "https://boardgamegeek.com/user/{username}", "searchDomain": "boardgamegeek.com", "enabled": true, "caseSensitive": false, "weight": 16},
|
|
193
|
+
{"id": "cgtrader", "name": "CGTrader", "category": "photography-design", "profileUrlTemplate": "https://www.cgtrader.com/{username}", "searchDomain": "cgtrader.com", "enabled": true, "caseSensitive": false, "weight": 14},
|
|
194
|
+
{"id": "sketchfab", "name": "Sketchfab", "category": "photography-design", "profileUrlTemplate": "https://sketchfab.com/{username}", "searchDomain": "sketchfab.com", "enabled": true, "caseSensitive": false, "weight": 18},
|
|
195
|
+
{"id": "thingiverse", "name": "Thingiverse", "category": "photography-design", "profileUrlTemplate": "https://www.thingiverse.com/{username}", "searchDomain": "thingiverse.com", "enabled": true, "caseSensitive": false, "weight": 18},
|
|
196
|
+
{"id": "printables", "name": "Printables", "category": "photography-design", "profileUrlTemplate": "https://www.printables.com/@{username}", "searchDomain": "printables.com", "enabled": true, "caseSensitive": false, "weight": 14},
|
|
197
|
+
{"id": "pexels", "name": "Pexels", "category": "photography-design", "profileUrlTemplate": "https://www.pexels.com/@{username}/", "searchDomain": "pexels.com", "enabled": true, "caseSensitive": false, "weight": 16},
|
|
198
|
+
{"id": "coroflot", "name": "Coroflot", "category": "photography-design", "profileUrlTemplate": "https://www.coroflot.com/{username}", "searchDomain": "coroflot.com", "enabled": true, "caseSensitive": false, "weight": 12},
|
|
199
|
+
{"id": "redbubble", "name": "Redbubble", "category": "photography-design", "profileUrlTemplate": "https://www.redbubble.com/people/{username}", "searchDomain": "redbubble.com", "enabled": true, "caseSensitive": false, "weight": 16},
|
|
200
|
+
{"id": "society6", "name": "Society6", "category": "photography-design", "profileUrlTemplate": "https://society6.com/{username}", "searchDomain": "society6.com", "enabled": true, "caseSensitive": false, "weight": 12},
|
|
201
|
+
{"id": "creative-market", "name": "Creative Market", "category": "photography-design", "profileUrlTemplate": "https://creativemarket.com/{username}", "searchDomain": "creativemarket.com", "enabled": true, "caseSensitive": false, "weight": 12},
|
|
202
|
+
{"id": "themeforest", "name": "ThemeForest (Envato)", "category": "photography-design", "profileUrlTemplate": "https://themeforest.net/user/{username}", "searchDomain": "themeforest.net", "enabled": true, "caseSensitive": false, "weight": 14},
|
|
203
|
+
{"id": "alik-cz", "name": "Alík.cz", "category": "regional-other", "profileUrlTemplate": "https://www.alik.cz/u/{username}", "searchDomain": "alik.cz", "enabled": true, "caseSensitive": false, "weight": 10},
|
|
204
|
+
{"id": "bezuzyteczna", "name": "Bezużyteczna", "category": "regional-other", "profileUrlTemplate": "https://bezuzyteczna.pl/uzytkownicy/{username}", "searchDomain": "bezuzyteczna.pl", "enabled": true, "caseSensitive": false, "weight": 10},
|
|
205
|
+
{"id": "wykop", "name": "Wykop", "category": "regional-other", "profileUrlTemplate": "https://wykop.pl/ludzie/{username}", "searchDomain": "wykop.pl", "enabled": true, "caseSensitive": false, "weight": 14},
|
|
206
|
+
{"id": "pikabu", "name": "Pikabu", "category": "regional-other", "profileUrlTemplate": "https://pikabu.ru/@{username}", "searchDomain": "pikabu.ru", "enabled": true, "caseSensitive": false, "weight": 14},
|
|
207
|
+
{"id": "zhihu", "name": "Zhihu", "category": "regional-other", "profileUrlTemplate": "https://www.zhihu.com/people/{username}", "searchDomain": "zhihu.com", "enabled": true, "caseSensitive": false, "weight": 16, "caveat": "Zhihu profile slugs are chosen separately from the display name."},
|
|
208
|
+
{"id": "note-com", "name": "note", "category": "regional-other", "profileUrlTemplate": "https://note.com/{username}", "searchDomain": "note.com", "enabled": true, "caseSensitive": false, "weight": 14},
|
|
209
|
+
{"id": "myfitnesspal", "name": "MyFitnessPal", "category": "regional-other", "profileUrlTemplate": "https://www.myfitnesspal.com/profile/{username}", "searchDomain": "myfitnesspal.com", "enabled": true, "caseSensitive": false, "weight": 14},
|
|
210
|
+
{"id": "couchsurfing", "name": "Couchsurfing", "category": "regional-other", "profileUrlTemplate": "https://www.couchsurfing.com/people/{username}", "searchDomain": "couchsurfing.com", "enabled": true, "caseSensitive": false, "weight": 14},
|
|
211
|
+
{"id": "geocaching", "name": "Geocaching", "category": "regional-other", "profileUrlTemplate": "https://www.geocaching.com/p/default.aspx?u={username}", "searchDomain": "geocaching.com", "enabled": true, "caseSensitive": false, "weight": 12},
|
|
212
|
+
{"id": "poshmark", "name": "Poshmark", "category": "regional-other", "profileUrlTemplate": "https://poshmark.com/closet/{username}", "searchDomain": "poshmark.com", "enabled": true, "caseSensitive": false, "weight": 16},
|
|
213
|
+
{"id": "depop", "name": "Depop", "category": "regional-other", "profileUrlTemplate": "https://www.depop.com/{username}/", "searchDomain": "depop.com", "enabled": true, "caseSensitive": false, "weight": 16}
|
|
117
214
|
]
|
|
118
215
|
}
|
|
@@ -51,12 +51,34 @@ def normalize_text(value: str | None) -> str:
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
def words(normalized: str) -> tuple[list[str], bool]:
|
|
54
|
-
"""Split normalised text into
|
|
54
|
+
"""Split normalised text into terms.
|
|
55
|
+
|
|
56
|
+
A fully quoted input ("a b") is unwrapped; quoted phrases inside the text (alice "antonio elena")
|
|
57
|
+
are kept as single terms, quotes included, so templates preserve them.
|
|
58
|
+
"""
|
|
55
59
|
s = normalized
|
|
56
60
|
quoted = len(s) >= 2 and s[0] == '"' and s[-1] == '"' and s.find('"', 1) == len(s) - 1
|
|
57
61
|
if quoted:
|
|
58
62
|
s = s[1:-1].strip()
|
|
59
|
-
|
|
63
|
+
out: list[str] = []
|
|
64
|
+
i, n = 0, len(s)
|
|
65
|
+
while i < n:
|
|
66
|
+
if s[i] == " ":
|
|
67
|
+
i += 1
|
|
68
|
+
continue
|
|
69
|
+
if s[i] == '"':
|
|
70
|
+
end = s.find('"', i + 1)
|
|
71
|
+
inner = (s[i + 1:] if end < 0 else s[i + 1:end]).strip()
|
|
72
|
+
if inner:
|
|
73
|
+
out.append(f'"{inner}"')
|
|
74
|
+
i = n if end < 0 else end + 1
|
|
75
|
+
continue
|
|
76
|
+
j = i
|
|
77
|
+
while j < n and s[j] != " ":
|
|
78
|
+
j += 1
|
|
79
|
+
out.append(s[i:j])
|
|
80
|
+
i = j
|
|
81
|
+
return out, quoted
|
|
60
82
|
|
|
61
83
|
|
|
62
84
|
def try_normalize_domain(value: str | None) -> str | None:
|
|
@@ -27,6 +27,8 @@ def looks_like_syntax(s: str) -> bool:
|
|
|
27
27
|
return True
|
|
28
28
|
if s[0] in "-+~()|":
|
|
29
29
|
return True
|
|
30
|
+
if len(s) > 1 and s[0] in "@#": # social-handle / hashtag operators
|
|
31
|
+
return True
|
|
30
32
|
if s[-1] in "()":
|
|
31
33
|
return True
|
|
32
34
|
colon = s.find(":")
|
|
@@ -36,8 +38,12 @@ def looks_like_syntax(s: str) -> bool:
|
|
|
36
38
|
|
|
37
39
|
|
|
38
40
|
def safe_term(word: str | None) -> str:
|
|
39
|
-
"""A single
|
|
40
|
-
|
|
41
|
+
"""A single term emitted unquoted; terms that would parse as syntax are quoted so they stay literal,
|
|
42
|
+
and a term the user already quoted ("antonio elena") is kept as a quoted phrase."""
|
|
43
|
+
raw = (word or "").strip()
|
|
44
|
+
if len(raw) >= 2 and raw[0] == '"' and raw[-1] == '"':
|
|
45
|
+
return quote(raw)
|
|
46
|
+
s = raw.replace('"', "")
|
|
41
47
|
if not s:
|
|
42
48
|
return ""
|
|
43
49
|
if looks_like_syntax(s):
|
|
@@ -11,7 +11,7 @@ import pytest
|
|
|
11
11
|
|
|
12
12
|
from dorksmith import bundled_catalogs, generate, validate_catalogs
|
|
13
13
|
|
|
14
|
-
FIXTURES = Path(__file__).resolve().parents[3] / "tests" / "
|
|
14
|
+
FIXTURES = Path(__file__).resolve().parents[3] / "tests" / "golden"
|
|
15
15
|
FILES = sorted(FIXTURES.glob("*.json")) if FIXTURES.is_dir() else []
|
|
16
16
|
_covered: set[str] = set()
|
|
17
17
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Quoted phrases and social-style tokens inside free-text input."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dorksmith import analyze_query, bundled_catalogs, generate, safe_term
|
|
5
|
+
from dorksmith.normalizer import words
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def test_words_keeps_user_quoted_phrases() -> None:
|
|
9
|
+
assert words('aelena "antonio elena"')[0] == ["aelena", '"antonio elena"']
|
|
10
|
+
assert words('"antonio elena" aelena x')[0] == ['"antonio elena"', "aelena", "x"]
|
|
11
|
+
assert words('a "" b')[0] == ["a", "b"]
|
|
12
|
+
assert words('a "unterminated phrase')[0] == ["a", '"unterminated phrase"']
|
|
13
|
+
assert words('"whole input quoted"') == (["whole", "input", "quoted"], True)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_safe_term_keeps_phrases_and_neutralises_social_tokens() -> None:
|
|
17
|
+
assert safe_term('"antonio elena"') == '"antonio elena"'
|
|
18
|
+
assert safe_term('"nested "quotes" inside"') == '"nested quotes inside"'
|
|
19
|
+
assert safe_term('""') == ""
|
|
20
|
+
assert safe_term("@aelena") == '"@aelena"'
|
|
21
|
+
assert safe_term("#osint") == '"#osint"'
|
|
22
|
+
assert safe_term("@") == "@"
|
|
23
|
+
assert safe_term("a@b") == "a@b"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def test_quoted_phrase_survives_variants() -> None:
|
|
27
|
+
r = generate('aelena "antonio elena"', "keyword", "general-discovery", options={"maxVariants": 12})
|
|
28
|
+
queries = [v.query for v in r.variants]
|
|
29
|
+
assert 'aelena "antonio elena"' in queries
|
|
30
|
+
assert '(aelena OR "antonio elena")' in queries
|
|
31
|
+
assert '"aelena antonio elena"' in queries
|
|
32
|
+
assert all('""' not in q for q in queries)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def test_leading_at_is_quoted_without_operator_warning() -> None:
|
|
36
|
+
r = generate("@aelena antonio elena", "keyword", "general-discovery", options={"maxVariants": 12})
|
|
37
|
+
for v in r.variants:
|
|
38
|
+
assert "@" not in v.operators, v.query
|
|
39
|
+
assert v.warnings == [], v.query
|
|
40
|
+
assert any(v.query == '"@aelena" antonio elena' for v in r.variants)
|
|
41
|
+
catalogs = bundled_catalogs()
|
|
42
|
+
assert analyze_query('"@aelena" antonio elena', catalogs.operators["google"], catalogs.operator_index("google")).operators == ['"']
|
|
@@ -128,6 +128,20 @@ def test_handles() -> None:
|
|
|
128
128
|
with pytest.raises(InputValidationError) as e:
|
|
129
129
|
expand_handle("has space")
|
|
130
130
|
assert e.value.field == "username"
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def test_extended_platform_catalog() -> None:
|
|
134
|
+
every = expand_handle("user123", max_platforms=250)
|
|
135
|
+
assert len(every.profiles) >= 180
|
|
136
|
+
assert len({p.platform_id for p in every.profiles}) == len(every.profiles)
|
|
137
|
+
urls = {p.platform_id: p.url for p in expand_handle("User123", platform_ids=["codewars", "9gag", "ao3", "livejournal"]).profiles}
|
|
138
|
+
assert urls["codewars"] == "https://www.codewars.com/users/user123"
|
|
139
|
+
assert urls["9gag"] == "https://9gag.com/u/user123"
|
|
140
|
+
assert urls["ao3"] == "https://archiveofourown.org/users/user123"
|
|
141
|
+
assert urls["livejournal"] == "https://user123.livejournal.com/"
|
|
142
|
+
with pytest.raises(InputValidationError) as e:
|
|
143
|
+
expand_handle("user123", max_platforms=251)
|
|
144
|
+
assert e.value.field == "maxPlatforms"
|
|
131
145
|
assert escape_data_string("a b!*'()~-_.") == "a%20b%21%2A%27%28%29~-_."
|
|
132
146
|
|
|
133
147
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|