|
37 | 37 | import jd.plugins.Plugin; |
38 | 38 | import jd.plugins.PluginException; |
39 | 39 | import jd.plugins.PluginForDecrypt; |
| 40 | +import jd.plugins.PluginForHost; |
| 41 | +import jd.plugins.hoster.DirectHTTP; |
40 | 42 |
|
41 | | -@DecrypterPlugin(revision = "$Revision: 50028 $", interfaceVersion = 3, names = { "luscious.net" }, urls = { "https?://(?:(?:www|members)\\.)?luscious\\.net/albums/([a-z0-9\\-_]+)_(\\d+)/?" }) |
| 43 | +@DecrypterPlugin(revision = "$Revision: 50034 $", interfaceVersion = 3, names = { "luscious.net" }, urls = { "https?://(?:(?:www|members)\\.)?luscious\\.net/albums/([a-z0-9\\-_]+)_(\\d+)/?" }) |
42 | 44 | public class LusciousNetAlbum extends PluginForDecrypt { |
43 | 45 | public LusciousNetAlbum(PluginWrapper wrapper) { |
44 | 46 | super(wrapper); |
@@ -116,23 +118,63 @@ public ArrayList<DownloadLink> decryptIt(final CryptedLink param, ProgressContro |
116 | 118 | if (br.getHttpConnection().getResponseCode() == 404) { |
117 | 119 | throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND); |
118 | 120 | } |
| 121 | + final String title = albumSlug.replace("-", " "); |
| 122 | + String[] thumbnails = br.getRegex("src=\"(https?://[^\"]+)\" class=\"\" loading=\"lazy\"").getColumn(0); |
| 123 | + if (thumbnails == null || thumbnails.length == 0) { |
| 124 | + thumbnails = br.getRegex("alt=\"\\d+\" src=\"(https?://[^\"]+)\"").getColumn(0); |
| 125 | + } |
| 126 | + final FilePackage fpFullsize = FilePackage.getInstance(); |
| 127 | + fpFullsize.setName(title); |
| 128 | + final FilePackage fpThumbnails = FilePackage.getInstance(); |
| 129 | + fpThumbnails.setName(title + " - thumbnails"); |
| 130 | + for (final String urlThumbnail : thumbnails) { |
| 131 | + /* Change thumbnail URL to a full size URL */ |
| 132 | + final String fullsizeUrl = urlThumbnail.replaceFirst("\\.315x0\\.jpg$", ".640x0.jpg"); |
| 133 | + /* This link may not always be available thus we will also add the original thumbnail link later. */ |
| 134 | + final DownloadLink directFullsize = this.createDownloadlink(DirectHTTP.createURLForThisPlugin(urlThumbnail)); |
| 135 | + /* We know that this link is online. */ |
| 136 | + directFullsize.setAvailable(true); |
| 137 | + directFullsize._setFilePackage(fpFullsize); |
| 138 | + ret.add(directFullsize); |
| 139 | + if (fullsizeUrl.equals(urlThumbnail)) { |
| 140 | + /* Both links are the same -> No reason to add thumbnail separately. */ |
| 141 | + continue; |
| 142 | + } |
| 143 | + final DownloadLink directThumbnail = this.createDownloadlink(DirectHTTP.createURLForThisPlugin(urlThumbnail)); |
| 144 | + /* We know that this link is online. */ |
| 145 | + directThumbnail.setAvailable(true); |
| 146 | + directThumbnail._setFilePackage(fpThumbnails); |
| 147 | + ret.add(directThumbnail); |
| 148 | + } |
119 | 149 | final String redirectURL = br.getRegex("\"(/download/r/\\d+/\\d+/?)\"").getMatch(0); |
120 | | - if (redirectURL == null) { |
121 | | - throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT); |
| 150 | + if (redirectURL != null) { |
| 151 | + final Browser brc = br.cloneBrowser(); |
| 152 | + brc.setFollowRedirects(false); |
| 153 | + brc.getPage(redirectURL); |
| 154 | + /* Typically redirects to external file hoster 9cloud.us. */ |
| 155 | + final String redirect = brc.getRedirectLocation(); |
| 156 | + if (redirect == null) { |
| 157 | + throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT); |
| 158 | + } |
| 159 | + final PluginForHost plg = this.getNewPluginForHostInstance("9cloud.us"); |
| 160 | + final DownloadLink link = this.createDownloadlink(redirect); |
| 161 | + if (plg.canHandle(redirect)) { |
| 162 | + link.setHost(plg.getHost()); |
| 163 | + link.setDefaultPlugin(plg); |
| 164 | + /** |
| 165 | + * For 9cloud.us we cannot find any filenames as long as any free download limit is reached which is often the case. |
| 166 | + * </br> |
| 167 | + * To counter that, we'll just set a filename here including the available status as we know that that file is online. |
| 168 | + */ |
| 169 | + link.setName(title + ".zip"); |
| 170 | + link.setAvailable(true); |
| 171 | + } |
| 172 | + link._setFilePackage(fpFullsize); |
| 173 | + ret.add(link); |
122 | 174 | } |
123 | | - final Browser brc = br.cloneBrowser(); |
124 | | - brc.setFollowRedirects(false); |
125 | | - brc.getPage(redirectURL); |
126 | | - /* Typically redirects to external file hoster 9cloud.us. */ |
127 | | - final String redirect = brc.getRedirectLocation(); |
128 | | - if (redirect == null) { |
| 175 | + if (ret.isEmpty()) { |
129 | 176 | throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT); |
130 | 177 | } |
131 | | - final DownloadLink link = this.createDownloadlink(redirect); |
132 | | - /* Set temporary filename */ |
133 | | - link.setName(albumSlug + ".zip"); |
134 | | - // link.setAvailable(true); |
135 | | - ret.add(link); |
136 | 178 | } |
137 | 179 | return ret; |
138 | 180 | } |
|
0 commit comments