Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

scrapy get inside attribute value

#Given 
<time datetime="2020-09-01T11:48:24-03:00" itemprop="datePublished">a given text</time>

# to get the attribute value datetime:
getData = response.css('time::attr(datetime)').get()

# output
'2020-09-01T11:48:24-03:00'
 
PREVIOUS NEXT
Tagged: #scrapy #attribute
ADD COMMENT
Topic
Name
3+5 =