this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: Integrate SoFurry API for submission details retrieval and update access token handling

+18 -7
+3 -1
.env.example
··· 49 49 50 50 # API Keys 51 51 # Weasyl API Key for accessing their API 52 - WEASYL_API_KEY=your_weasyl_api_key_here 52 + WEASYL_API_KEY=your_weasyl_api_key_here 53 + # SoFurry Access Token for accessing their API 54 + SOFURRY_ACCESS_TOKEN=your_sofurry_access_token_here
+4
config.js
··· 40 40 service: process.env.BLUESKY_SERVICE || 'https://bsky.social' 41 41 }, 42 42 43 + // API Keys 44 + soFurryAccessToken: process.env.SOFURRY_ACCESS_TOKEN, 45 + weasylApiKey: process.env.WEASYL_API_KEY, 46 + 43 47 // Supported websites for scraping 44 48 supportedSites: [ 45 49 {
+11 -6
scrapers/soFurryScraper.js
··· 18 18 } 19 19 20 20 // Call SoFurry API to get submission details 21 - const apiUrl = `https://api2.sofurry.com/std/getSubmissionDetails?id=${submissionId}&format=json`; 21 + const apiUrl = `https://api.sofurry.com/v1/submission/${submissionId}`; 22 + const headers = { 23 + "Authorization": `Bearer ${config.soFurryAccessToken}`, 24 + "Content-Type": "application/json", 25 + "Accept": "application/json" 26 + }; 22 27 const response = await axios.get(apiUrl); 23 28 24 29 if (!response.data) { ··· 26 31 } 27 32 28 33 // Get the content URL (full-sized image) 29 - const sourceImageUrl = response.data.contentSourceUrl; 34 + const sourceImageUrl = response.data.displayUrl; 30 35 if (!sourceImageUrl) { 31 - throw new Error('No content URL found in SoFurry API response'); 36 + throw new Error('No display URL found in SoFurry API response'); 32 37 } 33 38 34 39 // Check if this is a video ··· 72 77 } 73 78 74 79 extractSubmissionId(url) { 75 - // Extract submission ID from various SoFurry URL formats 76 - // Example: https://www.sofurry.com/view/1234567 or https://sofurry.com/art/1234567 77 - const idMatches = url.match(/(?:view|art|submission)\/(\d+)/i); 80 + // Extract submission ID from SoFurry URL format 81 + // Format: https://sofurry.com/s/{SubmissionID} 82 + const idMatches = url.match(/\/s\/(\d+)/i); 78 83 79 84 // If we found a match, return the first capture group (the ID) 80 85 return idMatches ? idMatches[1] : null;