twitter ripper now prfixes filenames
This commit is contained in:
parent
ab4fb97eac
commit
c4d6f6d9fd
@ -20,6 +20,8 @@ import com.rarchives.ripme.utils.Utils;
|
|||||||
|
|
||||||
public class TwitterRipper extends AlbumRipper {
|
public class TwitterRipper extends AlbumRipper {
|
||||||
|
|
||||||
|
int downloadUrls = 1;
|
||||||
|
|
||||||
private static final String DOMAIN = "twitter.com",
|
private static final String DOMAIN = "twitter.com",
|
||||||
HOST = "twitter";
|
HOST = "twitter";
|
||||||
|
|
||||||
@ -197,12 +199,18 @@ public class TwitterRipper extends AlbumRipper {
|
|||||||
urlToDownload = variant.getString("url");
|
urlToDownload = variant.getString("url");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
addURLToDownload(new URL(urlToDownload));
|
if (urlToDownload != null) {
|
||||||
|
addURLToDownload(new URL(urlToDownload), getPrefix(downloadUrls));
|
||||||
|
downloadUrls++;
|
||||||
|
} else {
|
||||||
|
LOGGER.error("URLToDownload was null");
|
||||||
|
}
|
||||||
parsedCount++;
|
parsedCount++;
|
||||||
} else if (media.getString("type").equals("photo")) {
|
} else if (media.getString("type").equals("photo")) {
|
||||||
if (url.contains(".twimg.com/")) {
|
if (url.contains(".twimg.com/")) {
|
||||||
url += ":orig";
|
url += ":orig";
|
||||||
addURLToDownload(new URL(url));
|
addURLToDownload(new URL(url), getPrefix(downloadUrls));
|
||||||
|
downloadUrls++;
|
||||||
parsedCount++;
|
parsedCount++;
|
||||||
} else {
|
} else {
|
||||||
LOGGER.debug("Unexpected media_url: " + url);
|
LOGGER.debug("Unexpected media_url: " + url);
|
||||||
@ -215,6 +223,10 @@ public class TwitterRipper extends AlbumRipper {
|
|||||||
return parsedCount;
|
return parsedCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPrefix(int index) {
|
||||||
|
return String.format("%03d_", index);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void rip() throws IOException {
|
public void rip() throws IOException {
|
||||||
getAccessToken();
|
getAccessToken();
|
||||||
|
Loading…
Reference in New Issue
Block a user