Search in gist only #179806
Replies: 5 comments
-
|
GitHub does not provide a public Search API for Gists. To find Gists you have two practical options: Scrape the Gist web search (https://gist.github.com/search?q=...) — quick and simple but unofficial and brittle. Index public gists yourself by pulling /gists/public (paginated) and searching your local index — reliable but heavier. Below I show example commands / code for both approaches and the pros/cons so you can pick. Option A — Quick (unofficial) — scrape the Gist search page The Gist web UI supports queries like https://gist.github.com/search?q=CVE-2. You can request that URL and parse the HTML to extract matching gist links. Example (Python + requests + BeautifulSoup): Requires: pip install requests beautifulsoup4import requests q = "CVE-2" soup = BeautifulSoup(resp.text, "html.parser") gist links on search results are anchors with href like //links = [] print unique matchesfor l in sorted(set(links)): Pros Simple and fast to implement. Finds the exact Gist web search results (same as what you see in a browser). Cons Unofficial — GitHub can change the HTML or block scraping. May violate GitHub TOS if abused; pay attention to rate limits and politeness. |
Beta Was this translation helpful? Give feedback.
-
|
you can’t use the GitHub Search API (v3) to search gists as you do repos — there is no “search gists” endpoint. Here’s more detail and some possible workarounds |
Beta Was this translation helpful? Give feedback.
-
|
How do I submit a feature request to support this? |
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
|
Any work arounds? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
I'm using github search api to find relevant code or repo. But it works on repo only, how can I search gist only?
e.g by searching "CVE-2", I'm expecting to find https://gist.github.com/N3mes1s/d882ee7ca4ddcad150f94b7460508a32
Beta Was this translation helpful? Give feedback.
All reactions