File tree Expand file tree Collapse file tree
extractor/src/main/java/org/schabi/newpipe/extractor/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,9 +15,8 @@ public enum AffiliateService {
1515 AMAZON ,
1616 }
1717
18-
1918 public static DonationService getDonatoinServiceByLink (String link ) throws MalformedURLException {
20- URL url = new URL (link );
19+ URL url = new URL (fixLink ( link ) );
2120 switch (url .getHost ()) {
2221 case "www.patreon.com" :
2322 return DonationService .PATREON ;
@@ -33,11 +32,17 @@ public static DonationService getDonatoinServiceByLink(String link) throws Malfo
3332 }
3433
3534 public static AffiliateService getAffiliateServiceByLink (String link ) throws MalformedURLException {
36- URL url = new URL (link );
35+ URL url = new URL (fixLink ( link ) );
3736 switch (url .getHost ()) {
3837 case "amzn.to" : return AffiliateService .AMAZON ;
3938 default : return AffiliateService .NO_AFILIATE ;
4039 }
4140 }
4241
42+ private static String fixLink (String link ) {
43+ return (link .startsWith ("https://" ) || link .startsWith ("http://" ))
44+ ? link
45+ : "https://" + link ;
46+ }
47+
4348}
You can’t perform that action at this time.
0 commit comments