scrape/extract_images.sql

11 lines
379 B
MySQL
Raw Normal View History

2019-12-13 17:32:48 -05:00
SELECT
raw.code
--,raw.url
,x.seq
,mold.code[1]
,mold.seq
,x.img[1] img
FROM
scrape.raw
LEFT JOIN LATERAL REGEXP_MATCHES(html, $$background-image: url\((.*?(.jpg))$$::TEXT,'g') WITH ORDINALITY AS x(img, seq) ON TRUE
LEFT JOIN LATERAL regexp_matches(x.img[1],$$([A-Z,\.,0-9]{7,8}).*\.jpg$$) WITH ORDINALITY AS mold(code, seq) ON TRUE