mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-21 13:11:27 +02:00
Fixed HentaidudeRippper indentation.
This commit is contained in:
@@ -26,144 +26,144 @@ public class HentaidudeRipper extends AbstractSingleFileRipper {
|
|||||||
public DownloadThreadPool hentaidudeThreadPool = new DownloadThreadPool("hentaidudeThreadPool");
|
public DownloadThreadPool hentaidudeThreadPool = new DownloadThreadPool("hentaidudeThreadPool");
|
||||||
|
|
||||||
public HentaidudeRipper(URL url) throws IOException {
|
public HentaidudeRipper(URL url) throws IOException {
|
||||||
super(url);
|
super(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHost() {
|
public String getHost() {
|
||||||
return "hentaidude";
|
return "hentaidude";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDomain() {
|
public String getDomain() {
|
||||||
return "hentaidude.com";
|
return "hentaidude.com";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGID(URL url) throws MalformedURLException {
|
public String getGID(URL url) throws MalformedURLException {
|
||||||
|
|
||||||
Matcher m = p1.matcher(url.toExternalForm());
|
Matcher m = p1.matcher(url.toExternalForm());
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
return m.group(1);
|
return m.group(1);
|
||||||
}
|
}
|
||||||
throw new MalformedURLException(
|
throw new MalformedURLException(
|
||||||
"Expected hqporner URL format: " + "hentaidude.com/VIDEO - got " + url + " instead");
|
"Expected hqporner URL format: " + "hentaidude.com/VIDEO - got " + url + " instead");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Document getFirstPage() throws IOException {
|
public Document getFirstPage() throws IOException {
|
||||||
// "url" is an instance field of the superclass
|
// "url" is an instance field of the superclass
|
||||||
return Http.url(url).get();
|
return Http.url(url).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getURLsFromPage(Document doc) {
|
public List<String> getURLsFromPage(Document doc) {
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
Matcher m1 = p1.matcher(url.toString());
|
Matcher m1 = p1.matcher(url.toString());
|
||||||
if (m1.matches()) {
|
if (m1.matches()) {
|
||||||
result.add(url.toString());
|
result.add(url.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can add support for search page.
|
// Can add support for search page.
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean tryResumeDownload() {
|
public boolean tryResumeDownload() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void downloadURL(URL url, int index) {
|
public void downloadURL(URL url, int index) {
|
||||||
// addURLToDownload(url, "", "", "", null, getVideoName(), "mp4");
|
// addURLToDownload(url, "", "", "", null, getVideoName(), "mp4");
|
||||||
hentaidudeThreadPool.addThread(new HentaidudeDownloadThread(url, index));
|
hentaidudeThreadPool.addThread(new HentaidudeDownloadThread(url, index));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DownloadThreadPool getThreadPool() {
|
public DownloadThreadPool getThreadPool() {
|
||||||
return hentaidudeThreadPool;
|
return hentaidudeThreadPool;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class HentaidudeDownloadThread extends Thread {
|
private class HentaidudeDownloadThread extends Thread {
|
||||||
|
|
||||||
private URL url;
|
private URL url;
|
||||||
|
|
||||||
public HentaidudeDownloadThread(URL url, int index) {
|
public HentaidudeDownloadThread(URL url, int index) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
// this.index = index;
|
// this.index = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
Document doc = Http.url(url).get();
|
Document doc = Http.url(url).get();
|
||||||
URL videoSourceUrl = new URL(getVideoUrl(doc));
|
URL videoSourceUrl = new URL(getVideoUrl(doc));
|
||||||
addURLToDownload(videoSourceUrl, "", "", "", null, getVideoName(), "mp4");
|
addURLToDownload(videoSourceUrl, "", "", "", null, getVideoName(), "mp4");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Could not get video url for " + getVideoName(), e);
|
LOGGER.error("Could not get video url for " + getVideoName(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getVideoName() {
|
private String getVideoName() {
|
||||||
try {
|
try {
|
||||||
return getGID(url);
|
return getGID(url);
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
LOGGER.error("Unable to get video title from " + url.toExternalForm());
|
LOGGER.error("Unable to get video title from " + url.toExternalForm());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TO find data object: $.ajax({ url:
|
* TO find data object: $.ajax({ url:
|
||||||
* 'https://hentaidude.com/wp-admin/admin-ajax.php', type: 'post', data: {
|
* 'https://hentaidude.com/wp-admin/admin-ajax.php', type: 'post', data: {
|
||||||
* action: 'msv-get-sources', id: '48227', nonce: '907f1bd45c' }
|
* action: 'msv-get-sources', id: '48227', nonce: '907f1bd45c' }
|
||||||
*/
|
*/
|
||||||
public String getVideoUrl(Document doc) throws IOException {
|
public String getVideoUrl(Document doc) throws IOException {
|
||||||
String jsonString = null;
|
String jsonString = null;
|
||||||
Matcher m = p2.matcher(doc.html());
|
Matcher m = p2.matcher(doc.html());
|
||||||
|
|
||||||
while (m.find()) {
|
while (m.find()) {
|
||||||
jsonString = m.group(1);
|
jsonString = m.group(1);
|
||||||
if (jsonString.contains("msv-get-sources"))
|
if (jsonString.contains("msv-get-sources"))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jsonString != null) {
|
if (jsonString != null) {
|
||||||
// send POST request to https://hentaidude.com/wp-admin/admin-ajax.php with the
|
// send POST request to https://hentaidude.com/wp-admin/admin-ajax.php with the
|
||||||
// data object parameters.
|
// data object parameters.
|
||||||
JSONObject dataObject = new JSONObject(jsonString);
|
JSONObject dataObject = new JSONObject(jsonString);
|
||||||
Map<String, String> dataMap = new HashMap<>();
|
Map<String, String> dataMap = new HashMap<>();
|
||||||
for (String key : JSONObject.getNames(dataObject)) {
|
for (String key : JSONObject.getNames(dataObject)) {
|
||||||
dataMap.put(key, dataObject.getString(key));
|
dataMap.put(key, dataObject.getString(key));
|
||||||
}
|
}
|
||||||
JSONObject jsonResopnse = Http.url("https://hentaidude.com/wp-admin/admin-ajax.php").data(dataMap)
|
JSONObject jsonResopnse = Http.url("https://hentaidude.com/wp-admin/admin-ajax.php").data(dataMap)
|
||||||
.method(Method.POST).getJSON();
|
.method(Method.POST).getJSON();
|
||||||
// return source url from below JSON.
|
// return source url from below JSON.
|
||||||
/*
|
/*
|
||||||
* success true sources { video-source-0
|
* success true sources { video-source-0
|
||||||
* https://cdn1.hentaidude.com/index.php?data=
|
* https://cdn1.hentaidude.com/index.php?data=
|
||||||
* 2f4a576957694872754d6736466f6c585579704b4d584e4a434372546c51346d4f4c697a6c734f6678307a59324c5458624f4675664863323768397a3371452f41384b62375246643243466f744447536b2b6250565a3859306a41506d366942713066336c6659386d78513d
|
* 2f4a576957694872754d6736466f6c585579704b4d584e4a434372546c51346d4f4c697a6c734f6678307a59324c5458624f4675664863323768397a3371452f41384b62375246643243466f744447536b2b6250565a3859306a41506d366942713066336c6659386d78513d
|
||||||
* video-source-1 <iframe src="https://openload.co/embed/iaJ_zDCTW0M/"
|
* video-source-1 <iframe src="https://openload.co/embed/iaJ_zDCTW0M/"
|
||||||
* scrolling="no" frameborder="0" width="100%" height="430"
|
* scrolling="no" frameborder="0" width="100%" height="430"
|
||||||
* allowfullscreen="true" webkitallowfullscreen="true"
|
* allowfullscreen="true" webkitallowfullscreen="true"
|
||||||
* mozallowfullscreen="true"></iframe> }
|
* mozallowfullscreen="true"></iframe> }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (jsonResopnse.getBoolean("success")) {
|
if (jsonResopnse.getBoolean("success")) {
|
||||||
// get the hentaidude video source
|
// get the hentaidude video source
|
||||||
for (String key : JSONObject.getNames(jsonResopnse.getJSONObject("sources"))) {
|
for (String key : JSONObject.getNames(jsonResopnse.getJSONObject("sources"))) {
|
||||||
if (jsonResopnse.getJSONObject("sources").getString(key).contains("hentaidude.com")) {
|
if (jsonResopnse.getJSONObject("sources").getString(key).contains("hentaidude.com")) {
|
||||||
return jsonResopnse.getJSONObject("sources").getString(key);
|
return jsonResopnse.getJSONObject("sources").getString(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new IOException("Could not get video url from JSON response.");
|
throw new IOException("Could not get video url from JSON response.");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new IOException("Could not get video download url.");
|
throw new IOException("Could not get video download url.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user