Repository navigation
Expand file tree
/
Copy pathgithub_scout.py
More file actions
123 lines (101 loc) · 4.37 KB
/
Copy pathgithub_scout.py
File metadata and controls
123 lines (101 loc) · 4.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
"""
Overseas scraper for GitHub
Collects candidate public repositories (metadata + release links only).
No installer package is downloaded; review and curate entries manually.
Target stack: Dart(Flutter) / Kotlin(Android native) / Swift(iOS native) / Tauri(Rust + tauri keyword)
Auto-filter: repositories without a README or without any Release are skipped.
Not targeted: plain HTML/CSS/JS web pages, H5, static sites, pure SDKs / libraries / templates
(remove these during manual review).
Dependencies: pip install requests
Run: python3 github_scout.py
"""
import base64
import json
import time
# ========== Config ==========
GITHUB_TOKEN = "" # GitHub personal token raises the rate limit; leave empty to run anonymously
OUTPUT_JSON = "raw_collect_en.json"
MIN_STARS = 5 # Drop very low-star repos
PER_PAGE = 30
# Dart / Kotlin / Swift; Tauri is Rust under the hood, matched by the "tauri" keyword
SEARCH_QUERY = (
"(language:Dart OR language:Kotlin OR language:Swift "
"OR (language:Rust tauri)) is:public sort:updated-desc"
)
# ============================
headers = {}
if GITHUB_TOKEN:
headers["Authorization"] = f"token {GITHUB_TOKEN}"
def fetch_readme(full_name):
"""Return (ok, readme_text). README helps reviewers understand the project."""
url = f"https://api.github.com/repos/{full_name}/readme"
resp = requests.get(url, headers=headers, timeout=10)
if resp.status_code != 200:
return False, ""
try:
content = base64.b64decode(resp.json()["content"]).decode("utf-8", errors="ignore")
except Exception:
content = ""
return True, content
def has_release(full_name):
"""Check whether the repo has at least one Release."""
url = f"https://api.github.com/repos/{full_name}/releases"
resp = requests.get(url, headers=headers, timeout=10)
return resp.status_code == 200 and len(resp.json()) > 0
def get_repos(page=1):
url = "https://api.github.com/search/repositories"
params = {"q": SEARCH_QUERY, "per_page": PER_PAGE, "page": page}
resp = requests.get(url, params=params, headers=headers, timeout=15)
if resp.status_code != 200:
print(f"Search failed {resp.status_code}: {resp.text}")
return []
return resp.json()["items"]
def main():
raw_list = []
print("Scraping: Dart / Kotlin / Swift / Tauri(Rust) | README + Release required")
repos = get_repos(page=1)
for repo in repos:
stars = repo["stargazers_count"]
if stars < MIN_STARS:
continue
full_name = repo["full_name"]
has_readme, _ = fetch_readme(full_name)
if not has_readme:
print(f"Skip {full_name}: no README")
time.sleep(0.4)
continue
if not has_release(full_name):
print(f"Skip {full_name}: no Release")
time.sleep(0.4)
continue
repo_url = repo["html_url"]
release_raw_url = f"{repo_url}/releases"
license_info = repo.get("license")
license_name = license_info["name"] if license_info else "No license specified"
item = {
"name": repo["name"],
"full_name": full_name,
"author": repo["owner"]["login"],
"description": repo["description"],
"language": repo["language"],
"framework": "", # Manual: Flutter / Android native / iOS native / Tauri
"stars": stars,
"repo_home": repo_url,
"release_page": release_raw_url,
"updated_at": repo["updated_at"],
"tags": [],
"platform": "", # Manual: android / ios / windows / mac / cross
"ui_lang": "", # Manual: Chinese / Multi (CN) / English
"license": license_name,
"is_passed": False # Set true after manual review
}
raw_list.append(item)
print(f"OK {full_name} | lang:{repo['language']} | license:{license_name} | stars:{stars}")
time.sleep(0.4)
with open(OUTPUT_JSON, "w", encoding="utf-8") as f:
json.dump(raw_list, f, ensure_ascii=False, indent=2)
print(f"\nDone. {len(raw_list)} entries saved to {OUTPUT_JSON}")
print("Review: read README -> fill framework / platform / ui_lang -> set is_passed = true")
except Exception as err:
print(f"\n❌ mistake:{err}")
input("\n按回车关闭窗口……")