-
-
Notifications
You must be signed in to change notification settings - Fork 878
A way to fetch others readme, without them having to manually do it. #672
Comments
I thing the API for users don't give back the customized readme. https://github.com/`username`/`username`/blob/main/README.md although it could be that the readme is in the to get repo data you could use https://docs.github.com/en/rest/reference/repos but I think you cannot get the readme there either.. |
Ok, I will try to find another way, thanks |
what we could do ist with github actions create automatically a screenshot of the readme. |
Yes, good ideas. |
I am working on this. Great finding, @schmelto! 🙂 |
Thanks all! |
The GitHub action that @schmelto mentioned is very good; it is what we need. But where is the user going to submit the URL? That's what I've been thinking about. Any ideas? 🤔 |
I suggest using GitHub Issues for that |
we have github issue forms now... So maybe we can use that to ask for a username a join it with 'github.com/' |
@schmelto I have a solution :) Can I work on it? async function generateWebsiteScreenshot (url, format = 'jpg') {
const job = await createCloudconvertJob(url, format)
const file = await getFileFromCloudconvertJob(job)
return uploadCaptureToStorage(file)
}
async function createCloudconvertJob (url, format = 'jpg') {
return cloudConvert.jobs.create({
tasks: {
'capture-url': {
operation: 'capture-website',
url,
output_format: format
},
'export-my-file': {
operation: 'export/url',
input: 'capture-url'
}
}
})
}
async function getFileFromCloudconvertJob (job) {
job = await cloudConvert.jobs.wait(job.id) // Wait for job completion
const exportTask = job.tasks.filter(
task => task.operation === 'export/url' && task.status === 'finished'
)[0]
return exportTask.result.files[0]
}
async function uploadCaptureToStorage (file) {
const temp = fs.createWriteStream('./res/' + file.filename)
https.get(file.url, async function (response) {
response.pipe(temp)
})
return new Promise((resolve, reject) => {
temp.on('finish', async () => {
fs.createReadStream(file.filename)
await fs.unlink(
file.filename
)
resolve()
})
temp.on('error', reject)
})
}
const profiles = require('./data.json')
profiles.forEach(profile => {
generateWebsiteScreenshot('https://github.com/' + profile.githubUsername, 'jpg')
}) |
@schmelto It would create a png file in 'assets' dir in the repo, is that fine? |
@krishguptadev it would be better if the binary file could be stored somewhere else? Could it be kept in the issue and we use the image url generated? Not sure if possible to automated it, I do this manually for things at the moment |
The only way is to store the files somewhere that would not change... 😅 |
Stale issue message |
What has to be done with this feature since the Nextjs Update? |
The NextJS upgrade was never completed, but I still think this feature can be added before or after |
Absolutely, jpeg/png binary files should ideally be no way near the repo, unless using Git LFS. If someone was to clone the repo they may have to also download all these PNG files which would need compression and if they change the Git history still has the previous revision, so it's not a "byte for byte replacement" |
It would just result in a mess... What I am thinking is that since it is going to be a nextjs website, we can easily just upload them to the site and create a next API which can queried for data? |
@schmelto , @Panquesito7 , @AvidCoder101 ,
I think this was mentioned, about having a way for a user to simply give a url, and github automatically fetches their readme data.
I am not sure how yet, but couldn't we use the github rest APIs? this is the link: https://docs.github.com/en/rest/reference/users
If we use the users api, in the link we can access their information, to get their readme. Thanks.
The text was updated successfully, but these errors were encountered: