[~] Refactor

This commit is contained in:
Siarhei Siniak 2021-07-15 08:10:19 +03:00
parent 1bc7838511
commit fc3f2dc351

@ -4,28 +4,39 @@ import pyquery
def kernel_1_sample_scrap(): def kernel_1_sample_scrap():
with requests.get( t8 = []
for t7 in [
'https://dev.to/kunaal438/media-query-everything-you-need-for-responsive-design-b8g', 'https://dev.to/kunaal438/media-query-everything-you-need-for-responsive-design-b8g',
) as p: ]:
t1 = p.content.decode('utf-8') with requests.get(
t2 = pyquery.PyQuery(t1) t7,
t3 = t2('.comment__content') ) as p:
t6 = [] t1 = p.content.decode('utf-8')
for o in t3: t2 = pyquery.PyQuery(t1)
t4 = pyquery.PyQuery(o) t3 = t2('.comment__content')
t5 = t4('.comment__header > a').attr['href'] t6 = []
t6.append( for o in t3:
t4 = pyquery.PyQuery(o)
t5 = t4('.comment__header > a').attr['href']
t6.append(
dict(
author=t5,
)
)
#pprint.pprint(t3)
pprint.pprint(t6)
t8.append(
dict( dict(
author=t5, article=t7,
comments=t6,
) )
) )
pprint.pprint(t3)
pprint.pprint(t6)
return dict( return dict(
t1=t1, t1=t1,
t2=t2, t2=t2,
t3=t3, t3=t3,
t6=t6, t6=t6,
t8=t8,
) )