Skip to content

Commit

Permalink
Update scraper.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandhunt committed Jan 26, 2020
1 parent 723f21c commit a4d7306
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions scraper.py
Expand Up @@ -645,12 +645,14 @@ def doesscrapeurlexist(scrapesitelist, scrapeurl):
prodlog_image_elements[i] = etree.tostring(prodlog_image_elements[i])
image_dom = ','.join(prodlog_image_elements)
if altimggrab == '1':
output = re.search(r'image\=\"(.*)\"', image_dom, flags=re.U)
#output = re.search(r'image\=\"(.*)\"', image_dom, flags=re.U)
output = re.search(r'image\=\"(.*?)\"', image_dom)
if output.len() > 0:
removed_top_element = output.pop(0)
prodlog_image_urls = output
elif altimggrab == '2':
output = re.search(r'src\=\"(.*)\"', image_dom, flags=re.U)
#output = re.search(r'src\=\"(.*)\"', image_dom, flags=re.U)
output = re.search(r'src\=\"(.*?)\"', image_dom)
if output.len() > 0:
removed_top_element = output.pop(0)
prodlog_image_urls = output
Expand Down Expand Up @@ -696,11 +698,11 @@ def doesscrapeurlexist(scrapesitelist, scrapeurl):
image_dom = ','.join(image_elements)
#print('IMAGE DOM: ' + image_dom)
if altimggrab == '1':
output = re.finditer(r'image\=\"(.*)\"', image_dom, flags=re.U)
#output = re.finditer(r'image\=\"(.*)\"', image_dom, flags=re.U)
output = re.finditer(r'image\=\"(.*?)\"', image_dom)
array_output = []
for output_el in output:

print(image_dom)
print('HEPP')
print(output_el.group())
print('HUPP')
Expand All @@ -711,7 +713,8 @@ def doesscrapeurlexist(scrapesitelist, scrapeurl):
#removed_top_element = output.pop(0)
image_urls = array_output[1]
elif altimggrab == '2':
output = re.search(r'src\=\"(.*)\"', image_dom, flags=re.U)
#output = re.search(r'src\=\"(.*)\"', image_dom, flags=re.U)
output = re.search(r'src\=\"(.*?)\"', image_dom)
if len(output.group()) > 0:
group = output.group()
removed_top_element = group.pop(0)
Expand Down

0 comments on commit a4d7306

Please sign in to comment.