问题
I'm trying to scrap 2 images from a YouTube channel, the profile picture, and the banner without using the official YouTube API.
This is where I'm trying to get the images from:
view-source:https://www.youtube.com/c/CyberpunkGame
The profile picture can be found in this field:
<link rel="image_src" href="https://yt3.ggpht.com/ytc/AAUvwnj_luY7M1Ps1THwD3jjpBGCK3IQD7xSl8VN8TQLlw=s900-c-k-c0x00ffffff-no-rj">
And the banner can be found here:
":2276,"height":376},{"url":"https://yt3.ggpht.com/1rRhEmeV6_SNWKl2pPhdT6csoTeJBBpuspsKmQbPlLzASMvbMY8beVUxbLqVqHLGeTrhXR08=w2560-fcrop64=1,00005a57ffffa5a8-k-c0xffffffff-no-nd-rj"
I want to extract only both URLs of the image images.
Thanks in advance.
回答1:
You can use the code from this class YoutubeChannelProfileImage.java
Example code:
String url = "www.youtube.com/...";
YoutubeChannelProfileImage.getYoutubeChannelProfileImage(url);
If you found it useful, please leave a star :)
来源:https://stackoverflow.com/questions/65450164/how-to-extract-image-link-using-jsoup