Как читать текст и получать определенные значения строк с помощью Scrapy

У меня есть требование нажать url ›http://something.com/requirements.txt Контент будет примерно таким, (response.text).

    From the 8th to the 12th century, Old English gradually transformed through language contact into Middle English. Middle English is often arbitrarily defined as beginning with the conquest of England by William the Conqueror in 1066, but it developed further in the period from 1200–1450.
    
Year: 2020

    First, the waves of Norse colonisation of northern parts of the British Isles in the 8th and 9th centuries put Old English into intense contact with Old Norse, a North Germanic language. Norse influence was strongest in the north-eastern varieties of Old English spoken in the Danelaw area around York, which was the centre of Norse colonisation; today these features are still particularly present in Scots and Northern English. However the centre of norsified English seems to have been in the Midlands around Lindsey, and after 920 CE when Lindsey was reincorporated into the Anglo-Saxon polity, Norse features spread from there into English varieties that had not been in direct contact with Norse speakers. An element of Norse influence that persists in all English varieties today is the group of pronouns beginning with th- (they, them, their) which replaced the Anglo-Saxon pronouns with h- (hie, him, hera).[43]

Я хочу очистить только год: значение из текстового ответа с помощью scrapy и сопоставить его с ItemLoader. Могу ли я как-нибудь справиться со скрапией?


person Satscreate    schedule 23.09.2020    source источник


Ответы (1)


Вы можете использовать регулярное выражение re.

import re

re.findall(r'Year: (.*)\n', response.text)
person Moein Kameli    schedule 23.09.2020