M
M
Millerish2016-06-25 20:36:05
Python
Millerish, 2016-06-25 20:36:05

Python how to properly parse src and text without id?

Good evening!
Tell me how to parse correctly. I want to understand how to correctly write a request for a picture and text on nnmclub.
Picture:

img class="postImg postImgAligned img-right" alt="pic" title="pic" src=" s020.radikal.ru/i716/1504/b7/e429d2b86ebd.jpg "

I'm trying this option:
response = requests.get(' nnmclub.to/forum/viewtopic.php?t=474369 ', timeout=10)
parsed_body = html.fromstring(response.text)
text_from_url = parsed_body.xpath('//span[@alt= "pic"]/img[@src]/text()')
print(post_img)

Issues:
function post_img at 0x7f695ac77510

Where is the mistake?
I don't understand how to parse the description. There is no description in the description to find it. Sample text on a page :
Description:
Video on editing a book in FB2, in FictionBook Editor 2.6.6.
Lessons are created specifically for the topic - Creating and editing books in fb2 format Send
all questions and discussions to this topic.
The topic will be updated as lessons are received.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2016-06-25
@Millerish

response = requests.get('nnmclub.to/forum/viewtopic.php?t=474369', timeout=10)
parsed_body = html.fromstring(response.text)
text_from_url = parsed_body.xpath('//span[@alt="pic"]/img[@src]/text()')
print(post_img) # post_img откуда???

Judging by the error, it should be like this:
print(post_img())

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question