changed regex to include eroshare.com

This commit is contained in:
cyian-1756 2017-07-29 21:51:41 -04:00
parent fb6e23e7d6
commit fdf82f5126

View File

@ -62,6 +62,18 @@ public class EroShareRipper extends AbstractHTMLRipper {
if (ma.matches()) { if (ma.matches()) {
return true; return true;
} }
Pattern p_eroshare = Pattern.compile("^https?://eroshare.com/([a-zA-Z0-9\\-_]+)/?$");
Matcher m_eroshare = p_eroshare.matcher(url.toExternalForm());
if (m_eroshare.matches()) {
return true;
}
Pattern p_eroshare_profile = Pattern.compile("^https?://eroshare.com/u/([a-zA-Z0-9\\-_]+)/?$");
Matcher m_eroshare_profile = p_eroshare_profile.matcher(url.toExternalForm());
if (m_eroshare_profile.matches()) {
return true;
}
return false; return false;
} }
@ -155,7 +167,8 @@ public class EroShareRipper extends AbstractHTMLRipper {
@Override @Override
public Document getFirstPage() throws IOException { public Document getFirstPage() throws IOException {
Response resp = Http.url(this.url) String urlToDownload = this.url.toExternalForm();
Response resp = Http.url(urlToDownload.replace("eroshare.com", "spacescience.tech"))
.ignoreContentType() .ignoreContentType()
.response(); .response();
@ -172,6 +185,18 @@ public class EroShareRipper extends AbstractHTMLRipper {
return m.group(1); return m.group(1);
} }
Pattern p_eroshare = Pattern.compile("^https?://eroshare.com/([a-zA-Z0-9\\-_]+)/?$");
Matcher m_eroshare = p_eroshare.matcher(url.toExternalForm());
if (m_eroshare.matches()) {
return m_eroshare.group(1);
}
Pattern p_eroshare_profile = Pattern.compile("^https?://eroshare.com/u/([a-zA-Z0-9\\-_]+)/?$");
Matcher m_eroshare_profile = p_eroshare_profile.matcher(url.toExternalForm());
if (m_eroshare_profile.matches()) {
return m_eroshare_profile.group(1) + "_profile";
}
Pattern pa = Pattern.compile("^https?://spacescience.tech/u/([a-zA-Z0-9\\-_]+)/?$"); Pattern pa = Pattern.compile("^https?://spacescience.tech/u/([a-zA-Z0-9\\-_]+)/?$");
Matcher ma = pa.matcher(url.toExternalForm()); Matcher ma = pa.matcher(url.toExternalForm());
if (ma.matches()) { if (ma.matches()) {