Skip to content
This repository was archived by the owner on Nov 18, 2024. It is now read-only.

Commit ffa673c

Browse files
committed
improves twitter versatility
1 parent 25e3b59 commit ffa673c

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

main.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const (
7676
RELEASE_API_URL = "https://api.github.com/repos/Seklfreak/discord-image-downloader-go/releases/latest"
7777
IMGUR_CLIENT_ID = "a39473314df3f59"
7878
REGEXP_URL_TWITTER = `^http(s?):\/\/pbs(-[0-9]+)?\.twimg\.com\/media\/[^\./]+\.(jpg|png)((\:[a-z]+)?)$`
79-
REGEXP_URL_TWITTER_STATUS = `^http(s?):\/\/(www\.)?twitter\.com\/([A-Za-z0-9-_\.]+\/status\/|statuses\/)([0-9]+)$`
79+
REGEXP_URL_TWITTER_STATUS = `^http(s?):\/\/(www\.)?twitter\.com\/([A-Za-z0-9-_\.]+\/status\/|statuses\/|i\/web\/status\/)([0-9]+)$`
8080
REGEXP_URL_TISTORY = `^http(s?):\/\/[a-z0-9]+\.uf\.tistory\.com\/(image|original)\/[A-Z0-9]+$`
8181
REGEXP_URL_TISTORY_WITH_CDN = `^http(s)?:\/\/[0-9a-z]+.daumcdn.net\/[a-z]+\/[a-zA-Z0-9\.]+\/\?scode=mtistory&fname=http(s?)%3A%2F%2F[a-z0-9]+\.uf\.tistory\.com%2F(image|original)%2F[A-Z0-9]+$`
8282
REGEXP_URL_GFYCAT = `^http(s?):\/\/gfycat\.com\/(gifs\/detail\/)?[A-Za-z]+$`
@@ -328,95 +328,95 @@ func getDownloadLinks(inputURL string, channelID string, interactive bool) map[s
328328
if RegexpUrlTwitter.MatchString(inputURL) {
329329
links, err := getTwitterUrls(inputURL)
330330
if err != nil {
331-
fmt.Println("twitter inputURL failed,", inputURL, ",", err)
331+
fmt.Println("twitter URL failed,", inputURL, ",", err)
332332
} else if len(links) > 0 {
333333
return skipDuplicateLinks(links, channelID, interactive)
334334
}
335335
}
336336
if RegexpUrlTwitterStatus.MatchString(inputURL) {
337337
links, err := getTwitterStatusUrls(inputURL, channelID)
338338
if err != nil {
339-
fmt.Println("twitter status inputURL failed,", inputURL, ",", err)
339+
fmt.Println("twitter status URL failed,", inputURL, ",", err)
340340
} else if len(links) > 0 {
341341
return skipDuplicateLinks(links, channelID, interactive)
342342
}
343343
}
344344
if RegexpUrlTistory.MatchString(inputURL) {
345345
links, err := getTistoryUrls(inputURL)
346346
if err != nil {
347-
fmt.Println("tistory inputURL failed,", inputURL, ",", err)
347+
fmt.Println("tistory URL failed,", inputURL, ",", err)
348348
} else if len(links) > 0 {
349349
return skipDuplicateLinks(links, channelID, interactive)
350350
}
351351
}
352352
if RegexpUrlGfycat.MatchString(inputURL) {
353353
links, err := getGfycatUrls(inputURL)
354354
if err != nil {
355-
fmt.Println("gfycat inputURL failed,", inputURL, ",", err)
355+
fmt.Println("gfycat URL failed,", inputURL, ",", err)
356356
} else if len(links) > 0 {
357357
return skipDuplicateLinks(links, channelID, interactive)
358358
}
359359
}
360360
if RegexpUrlInstagram.MatchString(inputURL) {
361361
links, err := getInstagramUrls(inputURL)
362362
if err != nil {
363-
fmt.Println("instagram inputURL failed,", inputURL, ",", err)
363+
fmt.Println("instagram URL failed,", inputURL, ",", err)
364364
} else if len(links) > 0 {
365365
return skipDuplicateLinks(links, channelID, interactive)
366366
}
367367
}
368368
if RegexpUrlImgurSingle.MatchString(inputURL) {
369369
links, err := getImgurSingleUrls(inputURL)
370370
if err != nil {
371-
fmt.Println("imgur single inputURL failed, ", inputURL, ",", err)
371+
fmt.Println("imgur single URL failed, ", inputURL, ",", err)
372372
} else if len(links) > 0 {
373373
return skipDuplicateLinks(links, channelID, interactive)
374374
}
375375
}
376376
if RegexpUrlImgurAlbum.MatchString(inputURL) {
377377
links, err := getImgurAlbumUrls(inputURL)
378378
if err != nil {
379-
fmt.Println("imgur album inputURL failed, ", inputURL, ",", err)
379+
fmt.Println("imgur album URL failed, ", inputURL, ",", err)
380380
} else if len(links) > 0 {
381381
return skipDuplicateLinks(links, channelID, interactive)
382382
}
383383
}
384384
if RegexpUrlGoogleDrive.MatchString(inputURL) {
385385
links, err := getGoogleDriveUrls(inputURL)
386386
if err != nil {
387-
fmt.Println("google drive album inputURL failed, ", inputURL, ",", err)
387+
fmt.Println("google drive album URL failed, ", inputURL, ",", err)
388388
} else if len(links) > 0 {
389389
return skipDuplicateLinks(links, channelID, interactive)
390390
}
391391
}
392392
if RegexpUrlFlickrPhoto.MatchString(inputURL) {
393393
links, err := getFlickrPhotoUrls(inputURL)
394394
if err != nil {
395-
fmt.Println("flickr photo inputURL failed, ", inputURL, ",", err)
395+
fmt.Println("flickr photo URL failed, ", inputURL, ",", err)
396396
} else if len(links) > 0 {
397397
return skipDuplicateLinks(links, channelID, interactive)
398398
}
399399
}
400400
if RegexpUrlFlickrAlbum.MatchString(inputURL) {
401401
links, err := getFlickrAlbumUrls(inputURL)
402402
if err != nil {
403-
fmt.Println("flickr album inputURL failed, ", inputURL, ",", err)
403+
fmt.Println("flickr album URL failed, ", inputURL, ",", err)
404404
} else if len(links) > 0 {
405405
return skipDuplicateLinks(links, channelID, interactive)
406406
}
407407
}
408408
if RegexpUrlFlickrAlbumShort.MatchString(inputURL) {
409409
links, err := getFlickrAlbumShortUrls(inputURL)
410410
if err != nil {
411-
fmt.Println("flickr album short inputURL failed, ", inputURL, ",", err)
411+
fmt.Println("flickr album short URL failed, ", inputURL, ",", err)
412412
} else if len(links) > 0 {
413413
return skipDuplicateLinks(links, channelID, interactive)
414414
}
415415
}
416416
if RegexpUrlStreamable.MatchString(inputURL) {
417417
links, err := getStreamableUrls(inputURL)
418418
if err != nil {
419-
fmt.Println("streamable inputURL failed, ", inputURL, ",", err)
419+
fmt.Println("streamable URL failed, ", inputURL, ",", err)
420420
} else if len(links) > 0 {
421421
return skipDuplicateLinks(links, channelID, interactive)
422422
}
@@ -435,7 +435,7 @@ func getDownloadLinks(inputURL string, channelID string, interactive bool) map[s
435435
if interactive {
436436
links, err := getGoogleDriveFolderUrls(inputURL)
437437
if err != nil {
438-
fmt.Println("google drive folder inputURL failed, ", inputURL, ",", err)
438+
fmt.Println("google drive folder URL failed, ", inputURL, ",", err)
439439
} else if len(links) > 0 {
440440
return skipDuplicateLinks(links, channelID, interactive)
441441
}

0 commit comments

Comments
 (0)