数据刮擦电影评论

发布于 01-24 15:42 字数 354 浏览 2 评论 0 原文

我正在尝试使用Python的电影网站来刮擦评论的文本及其各自的评分。唯一的问题是,该网站上的评分如下:如果电影的评分为6/10,则在HTML代码中的某个地方,我们将找到6个完整的星星图像和4个空星图像。我不知道如何将此评级提取为文本。 我也是Python的新手,因此,如果有人可以帮助我使用一件代码,您可以在其中提取评论的文本及其评分,我将非常感激。

这是电影《阿凡达》评论的URL:

I am trying to scrape the text of reviews and their respective rating from a movie site for my project using Python. The only problem is that the rating on this website is given in stars as follows: if a movie has a 6/10 rating then somewhere in the html code we will find 6 full stars images and 4 empty stars images. I don't know how to extract this rating as a text.
I am also a newbie with python so if anybody can help me with a piece of code where you extract the text of reviews and their rating I would be very grateful.

This is the url of reviews of the movie avatar: https://www.cinemagia.ro/filme/avatar-17818/reviews/?pagina=1&order_direction=DESC

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

说不完的你爱 2025-01-31 15:42:34

我将进行一个循环并循环循环通过恒星图像,并增加每个循环的计数。这将计算每个实例:

<img src="https://static.cinemagia.ro/img/star_full.gif">

可能会更具体地使用硒来缩进星星的XPATH位置?

如果您有代码的样本,我

I would make a loop and cycle through the star images and increase the count for each loop. This will count each instance of:

<img src="https://static.cinemagia.ro/img/star_full.gif">

I wouuld probably use selenium to fin the xpath location of the stars

If you have a sample of your code I can be more specific?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文