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

SourceForge kref #4172

Merged
merged 1 commit into from
Sep 3, 2024
Merged

Conversation

HebaruSan
Copy link
Member

@HebaruSan HebaruSan commented Sep 3, 2024

Motivation

Discord user "dan" pointed out that KSP2 mod KSRe (frozen in KSP-CKAN/KSP2-NetKAN#174 after its author deleted it from SpaceDock) has been posting updates at https://sourceforge.net/projects/ksre/:

image

https://sourceforge.net/projects/ksre/files/

Currently Netkan doesn't have the ability to crawl SourceForge, but while its API documentation looks quite inadequate, it does feature RSS-format (Really Simple Syndication, not Real Solar System) feeds for each mod's files:

https://sourceforge.net/projects/ksre/rss

Changes

Now a netkan with $kref: '#/ckan/sourceforge/ksre' will be indexed from SourceForge based on its RSS feed. Each <item> with a title ending in .zip is taken to be a download, and the first one is treated as most recent.

Retrieving and parsing the RSS feed went smoothly thanks to System.ServiceModel.Syndication.SyndicationFeed, but getting a download URL was tricky because SourceForge thought our user agent string looked too browser-like and so wasn't returning redirects, so I had to pass in an alternate user agent string.

Only a few fields can be set based on the minimal metadata in the feed, but luckily the swinfo.json parser is able to handle the rest.

@HebaruSan HebaruSan added Enhancement New features or functionality Spec Issues affecting the spec Netkan Issues affecting the netkan data Network Issues affecting internet connections of CKAN labels Sep 3, 2024
@HebaruSan HebaruSan merged commit 25af80c into KSP-CKAN:master Sep 3, 2024
3 checks passed
@HebaruSan HebaruSan deleted the feature/sourceforge-kref branch September 3, 2024 22:19
@HebaruSan

This comment was marked as resolved.

@HebaruSan
Copy link
Member Author

Apparently SourceForge's download link redirection does dynamic load balancing, so we potentially get a different URL each time:

image

Should figure out a way to stabilize that before we use this more widely...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New features or functionality Netkan Issues affecting the netkan data Network Issues affecting internet connections of CKAN Spec Issues affecting the spec
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant