File tree Expand file tree Collapse file tree 2 files changed +28
-6
lines changed
main/java/com/rarchives/ripme/ripper/rippers
test/java/com/rarchives/ripme/tst/ripper/rippers Expand file tree Collapse file tree 2 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -55,11 +55,34 @@ public Document getNextPage(Document doc) throws IOException {
5555 @ Override
5656 public List <String > getURLsFromPage (Document doc ) {
5757 List <String > imageURLs = new ArrayList <>();
58- for (Element thumb : doc .select ("a.dribbble-link > picture > source" )) {
59- // nl skips thumbnails
60- if ( thumb .attr ("srcset" ).contains ("teaser" )) continue ;
61- String image = thumb .attr ("srcset" ).replace ("_1x" , "" );
62- imageURLs .add (image );
58+ for (Element thumbLink : doc .select ("a.dribbble-link" )) {
59+ // Resolve the absolute shot page URL
60+ String shotPage = thumbLink .absUrl ("href" );
61+ if (shotPage .isEmpty ()) {
62+ continue ;
63+ }
64+
65+ // Fetch the shot page
66+ Document shotDoc ;
67+ try {
68+ shotDoc = Http .url (shotPage ).get ();
69+ } catch (IOException e ) {
70+ continue ;
71+ }
72+
73+ // Grab the first <img> (the full-size image) on that page
74+ Element imageEl = shotDoc .selectFirst ("div.shot-page-container img" );
75+ if (imageEl == null ) {
76+ continue ;
77+ }
78+
79+ // Always use absUrl so you get a complete URI or an empty string
80+ String imageURL = imageEl .absUrl ("src" );
81+ if (imageURL .isEmpty ()) {
82+ continue ;
83+ }
84+
85+ imageURLs .add (imageURL );
6386 }
6487 return imageURLs ;
6588 }
Original file line number Diff line number Diff line change 1010
1111public class DribbbleRipperTest extends RippersTest {
1212 @ Test
13- @ Disabled ("test or ripper broken" )
1413 public void testDribbbleRip () throws IOException , URISyntaxException {
1514 DribbbleRipper ripper = new DribbbleRipper (new URI ("https://dribbble.com/typogriff" ).toURL ());
1615 testRipper (ripper );
You can’t perform that action at this time.
0 commit comments