How to extract image link using Jsoup?

牧云@^-^@ 提交于 2021-01-04 05:56:31

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!