J
J
js_m1m2016-07-21 20:16:10
Python
js_m1m, 2016-07-21 20:16:10

How to parse RSS?

https://pythonhosted.org/feedparser/index.html is a link to a library that I have to work with as part of this task.
The bottom line is that you need to implement a function that will display the title, link to the article, a short description and the publication date of N articles. doen. And a function that will, by reference to one of the articles, display the same + ADDRESS on the picture, if any.
https://github.com/Killijoy/news-grubber - a turnip with my code.
I can't get the second function to work. I'm passing the link as a parameter, as said. But I still could not figure out how to display ALL of the listed parameters at once. I can't figure out the address of the image at all.
feed.image outputs from the full document, not from a single post. It displayed the tape.ru logo for me, for example, and not the picture for the post. How to deal with it?
It also says that entries do not have a content method at all. How to live with it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Gorovoy, 2016-07-21
@js_m1m

Ну парсить все что есть по шаблону, чего нет - ловить исключения.У некоторых новостей больше информации (допустим картинка, причем картинку можно вставить несколькими способами), так что нужно просто побывать разными способами.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question