File tree Expand file tree Collapse file tree 1 file changed +1
-27
lines changed
Expand file tree Collapse file tree 1 file changed +1
-27
lines changed Original file line number Diff line number Diff line change @@ -55,32 +55,6 @@ function fetchAvatarAsBase64(githubId) {
5555 } ) ;
5656}
5757
58- /**
59- * Extracts GitHub user ID from GitHub avatar URL
60- * @param {string } url - The GitHub avatar URL to parse
61- * @returns {string|null } - The extracted user ID or null if extraction fails
62- */
63- function extractGitHubId ( url ) {
64- try {
65- // Validate if it's a valid GitHub avatar URL
66- if ( ! url . includes ( "avatars.githubusercontent.com/u/" ) ) {
67- throw new Error ( "Not a valid GitHub avatar URL" ) ;
68- }
69-
70- // Use regular expression to extract user ID
71- const regex = / a v a t a r s \. g i t h u b u s e r c o n t e n t \. c o m \/ u \/ ( \d + ) / ;
72- const match = url . match ( regex ) ;
73-
74- if ( match && match [ 1 ] ) {
75- return match [ 1 ] ;
76- }
77- return null ;
78- } catch ( error ) {
79- console . error ( "Error:" , error . message ) ;
80- return null ;
81- }
82- }
83-
8458/**
8559 * Processes a list of githubIds and adds avatar_base64 property
8660 * @param {Array } ids - Array of id
@@ -145,7 +119,7 @@ async function main() {
145119 console . log ( "\n==> Processing avatars" ) ;
146120 const avatarsArray = await processAvatars ( uniqueGithubArray ) ;
147121
148- // 3 . Write files
122+ // 2 . Write files
149123 console . log ( `\n==> Write to ${ avatarFile } ` ) ;
150124 fs . writeFileSync ( avatarFile , JSON . stringify ( avatarsArray , null , 2 ) ) ;
151125
You can’t perform that action at this time.
0 commit comments