如何使用Jsoup提取图像链接? [英] How to extract image link using Jsoup?

查看:55
本文介绍了如何使用Jsoup提取图像链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在不使用官方YouTube API的情况下从YouTube频道中抓取2张图片,个人资料图片和横幅.

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">

横幅可以在这里找到:

":2276,"height":376},{"url":"https://yt3.ggpht.com/1rRhEmeV6_SNWKl2pPhdT6csoTeJBBpuspsKmQbPlLzASMvbMY8beVUxbLqVqHLGeTrhXR08=w2560-fcrop64=1,00005a57ffffa5a8-k-c0xffffffff-no-nd-rj"

我只想提取图像图像的两个URL.

I want to extract only both URLs of the image images.

谢谢.

推荐答案

您可以使用此类的代码 YoutubeChannelProfileImage.java

You can use the code from this class YoutubeChannelProfileImage.java

示例代码:

String url = "www.youtube.com/...";
YoutubeChannelProfileImage.getYoutubeChannelProfileImage(url);

如果您发现它有用,请加星号:)

If you found it useful, please leave a star :)

这篇关于如何使用Jsoup提取图像链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆