Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command for retrieving dependents for a repo #34

Closed
simonw opened this issue Apr 30, 2020 · 6 comments
Closed

Command for retrieving dependents for a repo #34

simonw opened this issue Apr 30, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Collaborator

simonw commented Apr 30, 2020

I really, really want to start grabbing this data: https://github.com/simonw/datasette/network/dependents

@simonw simonw added the enhancement New feature or request label Apr 30, 2020
@simonw
Copy link
Collaborator Author

simonw commented Apr 30, 2020

Unfortunately it's not available through any GitHub API - I managed to figure out how to get dependencies, but I need dependents. https://github.com/simonw/til/blob/master/github/dependencies-graphql-api.md

@simonw
Copy link
Collaborator Author

simonw commented Apr 30, 2020

It looks like the only option is to scrape them. I'll do that and then replace with an API as soon as one becomes available.

@simonw simonw changed the title Command for accessing dependents or a repo Command for accessing dependents for a repo Apr 30, 2020
@simonw
Copy link
Collaborator Author

simonw commented Apr 30, 2020

Proposed command:

github-to-sqlite scrape-dependents github.db simonw/datasette

I'll pull full details of the scraped repos from the regular API. I'll also record when they were "first seen" by the command.

@simonw
Copy link
Collaborator Author

simonw commented Apr 30, 2020

I think this is the neatest scraping pattern:

[a["href"].lstrip("/") for a in soup.select("a[data-hovercard-type=repository]")]

@simonw
Copy link
Collaborator Author

simonw commented Apr 30, 2020

And to find the "Next" pagination link:

soup.select(".paginate-container")[0].find("a", text="Next")

@simonw simonw changed the title Command for accessing dependents for a repo Command for retrieving dependents for a repo Apr 30, 2020
simonw added a commit that referenced this issue Apr 30, 2020
@simonw
Copy link
Collaborator Author

simonw commented Apr 30, 2020

Documentation: https://github.com/dogsheep/github-to-sqlite/blob/c9f48404481882e8b3af06f35e4801a80ac79ed6/README.md#scraping-dependents-for-a-repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant