Commit Graph

31 Commits

Author SHA1 Message Date
TobiGr 7c29dbc965 Fix JDoc
Add Checkstyle exception for LineLength in JDoc links.

See https://github.com/TeamNewPipe/NewPipeExtractor/actions/runs/8804403691/job/24164703883
2024-04-23 19:55:51 +02:00
AudricV 4b80d737a4
[Bandcamp] Add utility methods to get multiple images
Bandcamp images work with image IDs, which provide different resolutions.

Images on Bandcamp are not always squares, and some IDs respect aspect ratios
where some others not.

The extractor will only use the ones which preserve aspect ratio and will not
provide original images, for performance and size purposes.

Because of this aspect ratio preservation constraint, only one dimension will
be known at a time.

The image IDs with their respective dimension used are:

- 10: 1200w;
- 101: 90h;
- 170: 422h;
- 171: 646h;
- 20: 1024w;
- 200: 420h;
- 201: 280h;
- 202: 140h;
- 204: 360h;
- 205: 240h;
- 206: 180h;
- 207: 120h;
- 43: 100h;
- 44: 200h.

(Where w represents the width of the image and h the height of the image)

Note that these dimensions are theoretical because if the image size is less
than the dimensions of the image ID, it will be not upscaled but kept to its
original size.

All these resolutions are stored in a private static list of ThumbnailSuffixes
in BandcampExtractorHelper, in which the methods to get mutliple images have
been added:

- getImagesFromImageUrl(String): public method to get images from an image URL;
- getImagesFromImageId(long, boolean): public method to get images from an
  image ID;
- getImagesFromImageBaseUrl(String): private utility method to get images from
  the static list of ThumbnailSuffixes from a given image base URL, containing
  the path to the image, a "a" letter if it comes from an album, its ID and an
  underscore.

Some existing methods have been also edited:

- the documentation of getImageUrl(long, boolean) has been changed to reflect
  the Bandcamp images findings;
- getThumbnailUrlFromSearchResult has been renamed to
  getImagesFromSearchResult, and a documentation has been added to this method.

The method replaceHttpWithHttps of the Utils class has been also used in
BandcampExtractorHelper instead of doing manually what the method does.
2023-08-12 22:56:29 +02:00
AudricV 3891542ca1
Use Downloader's postWithContentType and postWithContentTypeJson methods in services and extractors 2022-11-22 11:37:18 +01:00
AudricV b9e463de49
[Bandcamp] Send Content-Type header in POST requests
This header was not sent before and was added and guessed by OkHttp. This can create issues when using other HTTP clients than OkHttp, such as Cronet.

Also make use of StandardCharsets.UTF_8 when getting bytes of bodies instead of the platform default's charset, to make sure to prevent some encoding issues on some JVMs.
2022-11-22 11:35:46 +01:00
TiA4f8R 3c3cd78676
Remove Checkstyle suppressions file and fix Checkstyle issues introduced in 24e8399 and 8c1041d
The Checkstyle suppressions file is now replaced by // CHECKSTYLE:OFF and // CHECKSTYLE:ON comments.
2022-05-02 21:51:25 +02:00
Stypox 24e83997b4
[Bandcamp] Add Java 8 streams 2022-03-26 22:07:12 +01:00
Stypox 3a94839359 [Bandcamp] Fix checkstyle issues 2022-03-26 19:40:17 +01:00
fynngodau 6db4bea8ca
Rework Bandcamp comments (#613) 2021-04-13 21:10:59 +02:00
Fynn Godau 2e57a8f24f [Bandcamp] Fix link handler acceptance behaviour
* Test for bandcamp footer instead of meta tag (which is not present on
  all pages)
* Accept links to /music, not just /releases
* Correctly handle uppercase URLs
2021-03-14 09:51:30 +01:00
TobiGr a1688fe953 Move BandcampExtractorHelper.getJsonData(String, String) to JsonUtils 2021-02-21 13:51:12 +01:00
TobiGr b9e8ee8450 Rename BandcampExtractorHelper.smartConcatenate(String[], String) to Utils.nonEmptyAndNullJoin(String, String[]) 2021-02-21 12:35:14 +01:00
TobiGr c07db80ef0 Add BASE_URL and BASE_API_URL to BandcampExtractorHelper 2021-02-21 12:15:45 +01:00
TobiGr adde4332d1 Code improvements 2021-02-20 23:58:54 +01:00
TobiGr fa61b864f2 Code improvements 2021-02-19 13:37:24 +01:00
TobiGr 98268e351c Move radio URL check into a function 2021-02-19 13:35:44 +01:00
TobiGr 74b46fed2d [Bandcamp] Fix deprecation in parseDate helper function 2020-12-19 10:40:21 +01:00
Fynn Godau 04dd3d4d32 Rework link handlers to correctly accept external websites 2020-12-05 15:08:26 +01:00
TobiGr 99e7ef013e [Bandcamp] Apply small changes to code formatting and style
Make variables final when possible
Remove unused imports
Improve code formatting
2020-11-24 14:13:31 +01:00
fynngodau 8c369b0f79
Rephrase link in javadoc
Co-authored-by: Tobias Groza <TobiGr@users.noreply.github.com>
2020-11-24 14:01:31 +01:00
Fynn Godau 81b5e7cf3d Fix extractor 2020-10-08 17:56:03 +02:00
Fynn Godau 96de834b67 Bandcamp: parse date from radio info item 2020-06-04 19:36:58 +02:00
Fynn Godau 0950a95577 Fix for testing wrong object for null or empty 2020-06-04 19:16:08 +02:00
Fynn Godau 27e7aad159 Bandcamp: Improve code style 2020-06-04 19:04:25 +02:00
Fynn Godau 692b2d06f4 Bandcamp: read info item data in place and not in advance 2020-05-25 18:53:15 +02:00
Fynn Godau a3e8e1c70e Bandcamp: move own methods to helper class 2020-04-26 23:05:56 +02:00
Fynn Godau 10ae3db118 Bandcamp javadoc: Replace br tags with p tags 2020-04-20 23:03:12 +02:00
Fynn Godau b100b9873f Bandcmap: Use nanojson fork instead of org.json 2020-04-20 21:53:04 +02:00
Fynn Godau 794ca5eeae Bandcamp channel extractor: handel nonexistent images better 2020-01-03 12:28:49 +01:00
Fynn Godau a42c77425d Bandcamp channel extractor (ignoring everything but tracks) 2020-01-03 12:28:49 +01:00
Fynn Godau 5281456899 Bandcamp channel link handler factory 2020-01-03 12:28:49 +01:00
Fynn Godau a579337c9a Bandcamp service with support for streams and searches 2020-01-03 12:28:49 +01:00