Commit Graph

46 Commits

Author SHA1 Message Date
ThetaDev 3673d4ae01
fix: YouTube trending name extraction 2023-05-03 21:16:35 +02:00
ThetaDev 24eba62305
fix: extract YouTube trends from new "Videos" tab 2023-05-03 21:16:23 +02:00
Isira Seneviratne e4d982c7ea Fix license. 2022-11-12 07:29:15 +05:30
Isira Seneviratne ddbce3b83d Add Utils methods for URL encoding/decoding using UTF-8. 2022-11-12 07:29:15 +05:30
Isira Seneviratne 366f5c1632 Use StandardCharsets.UTF_8. 2022-11-12 07:29:15 +05:30
AudricV d8ddeb549c
[YouTube] Support new trending structure and filter recently trending section
This new structure allow us to filter easily Trending shorts and Recently
trending sections.

On the previous one, this Recently trending section is now filtered, by
checking whether sections have a title, which isn't the case for normal trends
contrary to the other ones.

This makes that the extractor returns now only the real 50 "Now" YouTube
trends.

Elements inside arrays are now extracted dynamically instead of only the ones
of the first index, using Java 8's Stream API.

The getInitialPage() method of YoutubeTrendingExtractor can now throw a
ParsingException if no selected tab (corresponding to the one of the trends
type extracted) has been found.

Finally, the licence header has been moved to the top of the file and updated.
2022-09-11 18:52:12 +02:00
Stypox 740a37a2de [YouTube] Fix checkstyle issues 2022-03-26 19:42:40 +01:00
FireMasterK 2eeb0a3403
Rebase + some code improvements + fix extraction of age-restricted videos + update clients version
Here is now the requests which will be made by the `onFetchPage` method of `YoutubeStreamExtractor`:

- the desktop API is fetched.

If there is no streaming data, the desktop player API with the embed client screen will be fetched (and also the player code), then the Android mobile API.
- if there is no streaming data, a `ContentNotAvailableException` will be thrown by using the message provided in playability status

If the video is age restricted, a request to the next endpoint of the desktop player with the embed client screen will be sent.
Otherwise, the next endpoint will be fetched normally, if the content is available.

If the video is not age-restricted, a request to the player endpoint of the Android mobile API will be made.

We can get more streams by using the Android mobile API but some streams may be not available on this API, so the streaming data of the Android mobile API will be first used to get itags and then the streaming data of the desktop internal API will be used.
If the parsing of the Android mobile API went wrong, only the streams of the desktop API will be used.

Other code changes:

- `prepareJsonBuilder` in `YoutubeParsingHelper` was renamed to `prepareDesktopJsonBuilder`
- `prepareMobileJsonBuilder` in `YoutubeParsingHelper` was renamed to `prepareAndroidMobileJsonBuilder`
- two new methods in `YoutubeParsingHelper` were added: `prepareDesktopEmbedVideoJsonBuilder` and `prepareAndroidMobileEmbedVideoJsonBuilder`
- `createPlayerBodyWithSts` is now public and was moved to `YoutubeParsingHelper`
- a new method in `YoutubeJavaScriptExtractor` was added: `resetJavaScriptCode`, which was needed for the method `resetDebofuscationCode` of `YoutubeStreamExtractor`
- `areHardcodedClientVersionAndKeyValid` in `YoutubeParsingHelper` returns now a `boolean` instead of an `Optional<Boolean>`
- the `fetchVideoInfoPage` method of `YoutubeStreamExtractor` was removed because YouTube returns now 404 for every client with the `get_video_info` page
- some unused objects and some warnings in `YoutubeStreamExtractor` were removed and fixed

Co-authored-by: TiA4f8R <74829229+TiA4f8R@users.noreply.github.com>
2021-08-01 12:39:03 +02:00
TiA4f8R 4d682834c3
Fix localization and update client version 2021-08-01 12:38:03 +02:00
TiA4f8R f46cfb0f26
Adress reviews and do some improvements
Adress changes requested in reviews.
Do some improvements, remove unused imports and format some code to be in the 100 characters line limit.
2021-08-01 12:38:03 +02:00
TiA4f8R b49ae547a3
Do some improvements to YoutubeStreamExtractor
Get the real name of the uploader (for autogenerated channels and music artist channels), like before the migration to the JSON pbj.
Do some other improvements, especially reformatting some code to be in the 100 characters line limit and use final where possible.
2021-08-01 12:38:01 +02:00
TiA4f8R 77c031a88a
Use the youtubei API for YouTube trends 2021-08-01 12:36:28 +02:00
Stypox ce7cbbc9a0
[YouTube] Fix trending getName() 2021-03-24 09:14:09 +01:00
bopol a931e31239 fix tests 2021-02-12 22:36:18 +01:00
wb9688 9b6fe1dea6 Throw IllegalArgumentException when Page is invalid 2020-07-06 20:19:31 +02:00
wb9688 4cc312086a Introduce Page class 2020-07-06 20:19:31 +02:00
wb9688 e3bfdba135 Remove getNextPageUrl() function from ListExtractor 2020-07-06 20:11:40 +02:00
bopol 202a73516c refactor: add Utils.isNullOrEmpty() 2020-05-11 11:26:18 +02:00
bopol bc13e0c616 Merge remote-tracking branch 'upstream/dev' into soundcloudComments 2020-05-05 14:49:21 +02:00
wb9688 a1eabc7589 Return null instead of "" in getTextFromObject() 2020-05-02 08:02:25 +02:00
wb9688 b51699a20e Implement @TobiGr's suggestions 2020-04-20 14:27:33 +02:00
wb9688 979c5a7502 Use our fork of nanojson 2020-04-17 19:36:42 +02:00
bopol 636c430743 refactor: create extractors and linkHandler packages for SoundCloud, move YoutubeParsingHelper to youtube package (not linkhandler anymore) 2020-04-10 10:51:05 +02:00
wb9688 45df8248bf Use Localization in getJsonResponse() 2020-02-29 16:55:07 +01:00
wb9688 157055fbfd Create getJsonResponse() function 2020-02-29 16:42:04 +01:00
wb9688 365b0329f3 Implement getTextFromObject() function 2020-02-27 17:39:23 +01:00
wb9688 db305408e9 Get all expandedShelfContentsRenderers in YoutubeTrendingExtractor 2020-02-26 20:37:20 +01:00
wb9688 bb3a3d70bf Use pbj in YoutubeTrendingExtractor 2020-02-26 16:10:24 +01:00
wb9688 02b59903fa Remove useless code 2020-02-25 21:51:30 +01:00
TobiGr 5816202cc7 Move getInitialData() method to YouTubeParsingHelper
Rename ytInitialData to initialData
2020-02-25 21:51:30 +01:00
wb9688 38aabc6aca Use plain YoutubeStreamInfoItemExtractor in YoutubeTrendingExtractor 2020-02-25 21:51:30 +01:00
TobiGr a34e5c18e1 Trending StreamInfoItemCollecetor 2020-02-25 21:51:30 +01:00
TobiGr 655c999795 Detect disabled subriber count correctly
Fix parsing of kiosk name
2020-02-25 21:51:30 +01:00
TobiGr 030465b5d4 Improve code formatting and optimise imports 2020-02-15 13:36:54 +01:00
Mauricio Colli 3638f0e0ea
Implement time ago parser and improve localization handling
- Handle special cases for languages where the number is not shown
- Rework the Downloader base implementation, allowing for more
advanced things to be done
- Separate the localization from the content country (just like
YouTube let's the user choose both).
2019-11-03 15:46:21 -03:00
wojcik-online 180836c180
Base Implementation: Parse the upload date of StreamInfoItems
In the format '2 days ago' (in English) on a YouTube channel page.
(Parser extensible to other pages.)
2019-11-03 15:46:20 -03:00
Mauricio Colli c4fe2183ce
[YouTube] Improve detection of reCAPTCHA pages 2019-10-29 02:00:41 -03:00
Stypox 216a4eb1f5
Complete fix inconsistency in youtube channel urls
It is not always possible to get the url in the form "https://www.youtube.com/channel/...", so a not has been added whenever that happens to be the case (i.e. only in InfoStreamItems).
2019-08-16 21:17:03 +02:00
Christian Schabesberger 1503459292 add kiosk for conferences 2019-01-28 12:18:16 +01:00
Christian Schabesberger 0c3dc86b07 add support for yt content country 2018-10-06 12:22:37 +02:00
Christian Schabesberger ce2bbee1e9 add propper localization 2018-09-15 22:29:28 +02:00
Christian Schabesberger 28788a05db rename uih and remove afiliate link foo 2018-07-13 18:02:40 +02:00
Christian Schabesberger bd5423fe2a make less tests fail 2018-07-01 16:55:48 +02:00
Christian Schabesberger 17f46b8b12 rename UrlIdHandler to UIHFactory 2018-07-01 16:55:48 +02:00
Christian Schabesberger b4544a67e8 add SearchExtractor 2018-07-01 16:55:48 +02:00
Christian Schabesberger 94d1eb6f32 restructure youtube service 2018-05-08 21:19:03 +02:00