Parcourir la source

drop mastodon support

Drn il y a 2 ans
Parent
commit
d9761c0f8d
4 fichiers modifiés avec 1 ajouts et 40 suppressions
  1. 0 2
      README.md
  2. 0 9
      downloads.go
  3. 1 1
      main.go
  4. 0 28
      parse.go

+ 0 - 2
README.md

@@ -118,7 +118,6 @@ Now that that's out of the way...
 - Streamable
 - Gfycat
 - Tistory
-- Mastodon [BROKEN, WORKING ON IT]
 - Flickr _(requires API key, see config section)_
 - _I'll always welcome requests but some sources can be tricky to parse..._
   
@@ -206,7 +205,6 @@ You can either create a `settings.json` following the examples & variables liste
 - _Better command formatting & support_
 - Configuration is JSON-based rather than ini to allow more elaborate settings and better organization. With this came many features such as channel-specific settings.
 - Channel-specific control of downloaded filetypes / content types (considers things like .mov as videos as well, rather than ignore them), Optional dividing of content types into separate folders.
-- **Download Support for Reddit & Mastodon.**
 - (Optional) Reactions upon download success.
 - (Optional) Discord messages upon encountered errors.
 - Extensive bot status/presence customization.

+ 0 - 9
downloads.go

@@ -353,15 +353,6 @@ func getDownloadLinks(inputURL string, m *discordgo.Message) map[string]string {
 		}
 	}
 
-	if regexUrlMastodonPost1.MatchString(inputURL) || regexUrlMastodonPost2.MatchString(inputURL) {
-		links, err := getMastodonPostUrls(inputURL)
-		if err != nil {
-			log.Println(lg("Download", "", color.RedString, "Mastodon Post URL failed for %s -- %s", inputURL, err))
-		} else if len(links) > 0 {
-			return trimDownloadedLinks(links, m)
-		}
-	}
-
 	// The original project has this as an option,
 	if regexUrlPossibleTistorySite.MatchString(inputURL) {
 		links, err := getPossibleTistorySiteUrls(inputURL)

+ 1 - 1
main.go

@@ -37,7 +37,6 @@ import (
 * Fix filetype incorrect detection // constantly picking up webpages as txt files and NOT picking up proper media
 
 * Fix Support for Reddit
-* Fix Support for Mastodon
 * Fix Support for Instagram
 * Support Google Drive (folder; direct singles)
 * Support Dropbox (folder; direct singles)
@@ -47,6 +46,7 @@ import (
 * Support TikTok -- Tried, once the connection is closed the cdn URL is rendered invalid
 * Support Facebook Photos -- Tried, it doesn't preload image data, it's loaded in after. Would have to keep connection open, find alternative way to grab, or use api.
 * Support Facebook Videos -- Previously supported but they split mp4 into separate audio and video streams
+* Support Mastodon -- dropped due to login/api changes??
 
 * Add setting for filename max length, shorten if over given length, default to sys max
 

+ 0 - 28
parse.go

@@ -621,31 +621,3 @@ func getRedditPostUrls(link string) (map[string]string, error) {
 }
 
 //#endregion
-
-//#region Mastodon
-
-func getMastodonPostUrls(link string) (map[string]string, error) {
-	var post map[string]interface{}
-	err := getJSON(link+".json", &post)
-	if err != nil {
-		return nil, fmt.Errorf("failed to parse json from mastodon post:\t%s", err)
-	}
-	// Check for returned error
-	if errmsg, exists := post["error"]; exists {
-		return nil, fmt.Errorf("mastodon JSON returned an error:\t%s", errmsg)
-	}
-
-	// Check validity
-	if attachments, exists := post["attachment"]; exists {
-		files := make(map[string]string)
-		for _, attachmentObj := range attachments.([]interface{}) {
-			attachment := attachmentObj.(map[string]interface{})
-			files[attachment["url"].(string)] = ""
-		}
-		return files, nil
-	}
-
-	return nil, nil
-}
-
-//#endregion