diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 47648f9d3..d1417e46d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -314,6 +314,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/de/danoeh/antennapod/discovery/ItunesPodcastSearcher.java b/app/src/main/java/de/danoeh/antennapod/discovery/ItunesPodcastSearcher.java
index 6e894176f..5f3dd5f61 100644
--- a/app/src/main/java/de/danoeh/antennapod/discovery/ItunesPodcastSearcher.java
+++ b/app/src/main/java/de/danoeh/antennapod/discovery/ItunesPodcastSearcher.java
@@ -17,9 +17,12 @@ import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
public class ItunesPodcastSearcher implements PodcastSearcher {
private static final String ITUNES_API_URL = "https://itunes.apple.com/search?media=podcast&term=%s";
+ private static final String PATTERN_BY_ID = ".*/podcasts\\.apple\\.com/.*/podcast/.*/id(\\d+).*";
public ItunesPodcastSearcher() {
}
@@ -70,9 +73,12 @@ public class ItunesPodcastSearcher implements PodcastSearcher {
@Override
public Single lookupUrl(String url) {
+ Pattern pattern = Pattern.compile(PATTERN_BY_ID);
+ Matcher matcher = pattern.matcher(url);
+ final String lookupUrl = matcher.find() ? ("https://itunes.apple.com/lookup?id=" + matcher.group(1)) : url;
return Single.create(emitter -> {
OkHttpClient client = AntennapodHttpClient.getHttpClient();
- Request.Builder httpReq = new Request.Builder().url(url);
+ Request.Builder httpReq = new Request.Builder().url(lookupUrl);
try {
Response response = client.newCall(httpReq.build()).execute();
if (response.isSuccessful()) {
@@ -92,7 +98,7 @@ public class ItunesPodcastSearcher implements PodcastSearcher {
@Override
public boolean urlNeedsLookup(String url) {
- return url.contains("itunes.apple.com");
+ return url.contains("itunes.apple.com") || url.matches(PATTERN_BY_ID);
}
@Override